The options you're trying to use are wrong:

you need to use requestRequiredAcks instead of acks in the uri and brokers 
instead of bootstrapServers.

You can find the option here for 2.20.x

https://github.com/apache/camel/blob/camel-2.20.x/components/camel-kafka/src/main/docs/kafka-component.adoc

--
Andrea Cosentino 
----------------------------------
Apache Camel PMC Member
Apache Karaf Committer
Apache Servicemix PMC Member
Email: ancosen1...@yahoo.com
Twitter: @oscerd2
Github: oscerd






On Wednesday, March 7, 2018, 3:30:55 PM GMT+1, Ranabroto Ghosh 
<ranabroto.gh...@globalcharge.com> wrote: 





Hello

I have simple route triggered by REST api and want to put a message to kafka


*pom.xml*

    <dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-kafka</artifactId>
    <version>2.20.0</version>
    <exclusions>
    <exclusion>
    <groupId>org.apache.kafka</groupId>
    <artifactId>kafka-clients</artifactId>
    </exclusion>
    </exclusions>
</dependency>
    <dependency>
    <groupId>org.apache.kafka</groupId>
    <artifactId>kafka-clients</artifactId>
    <version>1.0.1</version>
</dependency>


Camle Route:

<route id="sample-route" autoStartup="true">
<from uri="restlet:/sample/{id}?restletMethods=GET" />
<log message="ID: ${header.id}"/>
<setBody><simple>${header.id}</simple></setBody>
<to uri="bean:sample?method=setHeaders"/>
<to uri="kafka:
rgdev8.globalcharge.com:9092?bootstrapServers=rgdev8.globalcharge.com:9092
&amp;retries=0&amp;acks=0
&amp;clientId=test
&amp;topic=test_topic_rana
&amp;groupId=test
&amp;serializerClass=org.apache.kafka.common.serialization.ByteArraySerializer"/>
<setBody><simple>${header.id}</simple></setBody>
</route>


I get below error:

Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to
resolve endpoint: kafka://
rgdev8.globalcharge.com:9092?acks=0&bootstrapServers=rgdev8.globalcharge.com%3A9092&clientId=test&groupId=test&retries=0&serializerClass=org.apache.kafka.common.serialization.ByteArraySerializer&topic=test_topic_rana
due to: There are 2 parameters that couldn't be set on the endpoint. Check
the uri if the parameters are spelt correctly and that they are properties
of the endpoint. Unknown parameters=[{acks=0, bootstrapServers=
rgdev8.globalcharge.com:9092}]
        at
org.apache.camel.impl.DefaultComponent.validateParameters(DefaultComponent.java:215)
        at
org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:139)
        at
org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:703)
        ... 86 more


I have tried removing all unknown parameters, and tried simple

<to uri="kafka:rgdev8.globalcharge.com:9092?topic=test_topic_rana
<http://rgdev8.globalcharge.com:9092/?topic=test_topic_rana>"/>

Then I get below error:

Caused by: java.lang.NullPointerException
        at java.util.Hashtable.put(Hashtable.java:460)
        at
org.apache.camel.component.kafka.KafkaProducer.getProps(KafkaProducer.java:63)
        at
org.apache.camel.component.kafka.KafkaProducer.doStart(KafkaProducer.java:89)
        at
org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
        at
org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75)
        at
org.apache.camel.impl.DeferServiceStartupListener.onCamelContextStarted(DeferServiceStartupListener.java:49)
        at
org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3846)
        at
org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3625)
        at
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3477)
        at
org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:208)
        at
org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3236)
        at
org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3232)
        at
org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3255)
        at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3232)
        at
org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
        at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3155)
        at
org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:133)
        ... 64 more

I can confirm my kafka server is working fine, as i can put message and
retried using kafka console create producer and consumer terminal.  Please
help

-- 
Kind Regards
Rana

Reply via email to