git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Having problem while creating producer from camel route for Kafka


 Many thanks, it worked.

On 7 March 2018 at 14:52, Ranabroto Ghosh <ranabroto.ghosh@xxxxxxxxxxxxxxxx>
wrote:

> Many thanks, it worked.
>
> On 7 March 2018 at 14:35, Andrea Cosentino-2 [via Camel] <
> ml+s465427n5818242h7@xxxxxxxxxxxxx> wrote:
>
>> 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: [hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=5818242&i=0>
>> Twitter: @oscerd2
>> Github: oscerd
>>
>>
>>
>>
>>
>>
>> On Wednesday, March 7, 2018, 3:30:55 PM GMT+1, Ranabroto Ghosh <[hidden
>> email] <http:///user/SendEmail.jtp?type=node&node=5818242&i=1>> 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.globalc
>> harge.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.onCamelCon
>> textStarted(DeferServiceStartupListener.java:49)
>>         at
>> org.apache.camel.impl.DefaultCamelContext.safelyStartRouteSe
>> rvices(DefaultCamelContext.java:3846)
>>         at
>> org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRou
>> tes(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.doWithDefinedClass
>> Loader(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
>>
>>
>> ------------------------------
>> If you reply to this email, your message will be added to the discussion
>> below:
>> http://camel.465427.n5.nabble.com/Having-problem-while-creat
>> ing-producer-from-camel-route-for-Kafka-tp5818241p5818242.html
>> To unsubscribe from Camel, click here
>> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465427&code=cmFuYWJyb3RvLmdob3NoQGdsb2JhbGNoYXJnZS5jb218NDY1NDI3fC0xNDE1NjM5OTY5>
>> .
>> NAML
>> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>
> --
> Kind Regards
> Rana
>



-- 
Kind Regards
Rana