[
https://issues.apache.org/jira/browse/CAMEL-18938?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-18938:
--------------------------------
Component/s: camel-kafka
> camel-endpoint-dsl - Map type trouble to use Map instance
> ---------------------------------------------------------
>
> Key: CAMEL-18938
> URL: https://issues.apache.org/jira/browse/CAMEL-18938
> Project: Camel
> Issue Type: Improvement
> Components: camel-kafka
> Affects Versions: 3.18.4
> Reporter: Claus Ibsen
> Priority: Major
>
> Hi Camel experts,
> I am struggling with a Kafka component and passing in parameters via
> additionalProperties. I am not able to propagate an Object. I tested
> only Endpoint DSL. According to the Camel docs and APIs, I am allowed
> to pass in an instance of Map<String, Object>
> Camel version: 3.18.4
> ----Pseudocode-----
> @Configuration
> Class SpringConfig
> @Bean(name = "autowiredMap")
> public Map<String, Object> autowiredMap() {
> var map = new HashMap<String, Object>();
> map.put("testStringKey3", "testStringValue3");
> map.put("testObjectKey3", new Object());
> }
> -------
> Class MainRoute extends RouteBuilder()
> @Autowired
> @Qualifier("autowiredMap")
> Map<String, Object> autowiredMap;
> var map = new HashMap<String, Object>();
> map.put("testStringKey1", "testStringValue1");
> map.put("testObjectKey1", new Object());
> from(kafka(…basic configuration works)
> .schemaRegistryURL(http://original.com)
> .additionalProperties(map)
> .additionalProperties("testStringKey2", "testStringValue2")
> .additionalProperties("testObjectKey1", new Object())
> .additionalProperties("schema.registry.url", http://overwritten.com)
> .additionalProperties(autowiredMap)...
> Expected:
> All properties from all additionalProperties methods are propagated to
> the Kafka Properties configuration object.
> In reality, Properties will contain the following:
> schema.registry.url=http://overwritten.com
> testStringKey1=testStringValue1
> testStringKey2=testStringValue2
> Non-string values are not propagated at all. Values from autowired Map
> are not propagated at all. Autowired map is treated as
> additionalProperties.autowiredMap=HashMap@123456
> I can see those String values being added to the Kafka Endpoint URI:
> kafka://additionalProperties.testStringKey1=xxx&additionalProperties.testStringKey2=xxx&additionalProperties.schema.registr.url=xxx..
> Is it a bug in Camel or did I understand the documentation wrong? I
> can prepare a test case later
> Best regards,
> Martin
--
This message was sent by Atlassian Jira
(v8.20.10#820010)