Fyi, using Spring Boot and/or Camel, you can and should specify kafka
properties in property / yaml files. You dont need to create a Kafka
Component. Spring/Camel will do that for you. That is what they do. That
way it will be configured correctly.

https://docs.spring.io/spring-boot/docs/current/reference/html/application-properties.html#application-properties.integration
https://camel.apache.org/camel-spring-boot/3.7.x/kafka-starter.html

On Thu, Jul 15, 2021 at 11:10 AM Ajmera, Hemang C <[email protected]>
wrote:

> Hi
>
>    I am configuring kafka component using some default values configured
> via springboot configurations. This code works fine for camel 3.4.5,
> however it is not working with camel 3.11.0. I checked the migration
> documents, but didn’t find anything significant. When I check the output,
> kakfa is configured with default values and not with what I am providing.
> Here is the code which is used for configuration kafka component
>
>
>
> @Configuration
>
> @EnableConfigurationProperties(KafkaComponentProperties.class)
>
> public class KafkaComponentFactory {
>
>
>
>     @Autowired(required = false)
>
>     KafkaComponentProperties kafkaProp;
>
>
>
>     @Bean("kafka")
>
>     public KafkaComponent createKafkaComponent() throws KafkaException {
>
>
>
>         KafkaComponent kafka = new KafkaComponent();
>
>         KafkaConfiguration kafkaConfiguration = new KafkaConfiguration();
>
>
>
>         kafkaConfiguration.setSaslMechanism(kafkaProp.getSaslMechanism());
>
>
>        
> kafkaConfiguration.setSecurityProtocol(kafkaProp.getSecurityProtocol());
>
>         kafkaConfiguration.setGroupId(kafkaProp.getGroupId());
>
>         kafkaConfiguration.setBrokers(kafkaProp.getBrokers());
>
>
> kafkaConfiguration.setSslTruststorePassword(kafkaProp.getSslTruststorePassword());
>
>
> kafkaConfiguration.setSslKeystorePassword(kafkaProp.getSslKeystorePassword());
>
>
> kafkaConfiguration.setSslTruststoreLocation(kafkaProp.getSslTruststoreLocation());
>
>
> kafkaConfiguration.setSslKeystoreLocation(kafkaProp.getSslKeystoreLocation());
>
>
> kafkaConfiguration.setAutoCommitEnable(kafkaProp.getAutoCommitEnable());
>
>
> kafkaConfiguration.setAllowManualCommit(kafkaProp.getAllowManualCommit());
>
>
> kafkaConfiguration.setSslEndpointAlgorithm(kafkaProp.getSslEndpointAlgorithm());
>
>
>
>         kafka.setConfiguration(kafkaConfiguration);
>
>
>
>         System.setProperty("java.security.auth.login.config",
> kafkaProp.getKafkaClientConfigFilePath());
>
>
>
>         return kafka;
>
>
>
>     }
>
>
>
>
>
>
>
> Thanks and Regards,
>
> Hemang Ajmera
>
>
>
> *Hemang C Ajmera* | Technical Architect
>
> Asia Pacific Communications, Media and Utilities Delivery Center | CGI
>
> Block 5, DLF-SEZ, Manapakkam, Chennai – 600089, India
> O: +91-44-6647-3828 | M: +91-89397-07557 | M: +91-98841-66619 | VOIP:
> 8083828
>
> [email protected] | www.cgi.com
>
> [image: Description: Description: Description: Description: Description:
> Description: Description:
> C:\Users\rahul.muthalali\AppData\Local\Microsoft\Windows\Temporary Internet
> Files\Content.Word\Top_Employer_India_English_2016.gif]
>
>
>

Reply via email to