You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by tapdur <ta...@gmail.com> on 2014/12/02 18:26:17 UTC

camel kafka - provider no partition key

Hi,

i use the camel-kafka component and when i send a message to a topic it
raise an error : 	No partition key set.			
t is due to the new api of the component. on the wiki page there is a sample
for the consumer xml dsl but 
none for the provider, 

<from
uri="kafka:localhost:9092?topic=orders&amp;zookeeperHost=localhost&amp;zookeeperPort=2181&amp;groupId=orders"/>

any idea ?

thx
Best Regards
Bruno 



Message History
---------------------------------------------------------------------------------------------------------------------------------------
RouteId              ProcessorId          Processor                                                                       
Elapsed (ms)
[route7            ] [route7            ]
[servlet:///customers/neworder?httpMethodRestrict=POST                        
] [        10]
[route7            ] [restBinding3      ] [                                                                             
] [         3]
[route7            ] [to4               ] [direct:customerNewOrder                                                      
] [         4]
[route3            ] [log1              ] [log                                                                          
] [         1]
[route3            ] [to1               ]
[kafka:localhost:9092?topic=orders&zookeeperHost=localhost&zookeeperPort=2181 
] [         2]

Exchange
---------------------------------------------------------------------------------------------------------------------------------------
Exchange[
	Id                  ID-P-7ZZ3CGBI-58294-1417540637830-1-2
	ExchangePattern     InOut
	Headers             {accept=*/*, accept-encoding=gzip,deflate,sdch,
accept-language=fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4,
breadcrumbId=ID-P-7ZZ3CGBI-58294-1417540637830-1-1,
CamelHttpCharacterEncoding=UTF-8, CamelHttpMethod=POST, CamelHttpPath=,
CamelHttpQuery=null,
CamelHttpServletRequest=org.apache.catalina.connector.RequestFacade@1350201,
CamelHttpServletResponse=org.apache.catalina.connector.ResponseFacade@116b42c,
CamelHttpUri=/customers/neworder,
CamelHttpUrl=http://localhost:8080/customers/neworder,
CamelRedelivered=false, CamelRedeliveryCounter=0,
CamelServletContextPath=/customers/neworder, connection=keep-alive,
content-length=55, Content-Type=application/json,
cookie=_pk_id.2.1fff=026a212c399ad03f.1410797639.15.1411684275.1411681543.,
dnt=1, host=localhost:8080,
origin=chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo,
user-agent=Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/35.0.1916.153 Safari/537.36}
	BodyType            org.apache.camel.converter.stream.InputStreamCache
	Body                [Body is instance of org.apache.camel.StreamCache]
]

Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------

org.apache.camel.CamelExchangeException: No partition key set.
Exchange[Message: [Body is instance of org.apache.camel.StreamCache]]
	at
org.apache.camel.component.kafka.KafkaProducer.process(KafkaProducer.java:67)




 



--
View this message in context: http://camel.465427.n5.nabble.com/camel-kafka-provider-no-partition-key-tp5759971.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel kafka - provider no partition key

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You can try take a look in the unit tests of camel-kafka and see how
the producer works there.
But there may indeed be a mistake in the code or the documentation
page. If that is the case, you are welcome to log a JIRA

On Tue, Dec 2, 2014 at 6:26 PM, tapdur <ta...@gmail.com> wrote:
> Hi,
>
> i use the camel-kafka component and when i send a message to a topic it
> raise an error :        No partition key set.
> t is due to the new api of the component. on the wiki page there is a sample
> for the consumer xml dsl but
> none for the provider,
>
> <from
> uri="kafka:localhost:9092?topic=orders&amp;zookeeperHost=localhost&amp;zookeeperPort=2181&amp;groupId=orders"/>
>
> any idea ?
>
> thx
> Best Regards
> Bruno
>
>
>
> Message History
> ---------------------------------------------------------------------------------------------------------------------------------------
> RouteId              ProcessorId          Processor
> Elapsed (ms)
> [route7            ] [route7            ]
> [servlet:///customers/neworder?httpMethodRestrict=POST
> ] [        10]
> [route7            ] [restBinding3      ] [
> ] [         3]
> [route7            ] [to4               ] [direct:customerNewOrder
> ] [         4]
> [route3            ] [log1              ] [log
> ] [         1]
> [route3            ] [to1               ]
> [kafka:localhost:9092?topic=orders&zookeeperHost=localhost&zookeeperPort=2181
> ] [         2]
>
> Exchange
> ---------------------------------------------------------------------------------------------------------------------------------------
> Exchange[
>         Id                  ID-P-7ZZ3CGBI-58294-1417540637830-1-2
>         ExchangePattern     InOut
>         Headers             {accept=*/*, accept-encoding=gzip,deflate,sdch,
> accept-language=fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4,
> breadcrumbId=ID-P-7ZZ3CGBI-58294-1417540637830-1-1,
> CamelHttpCharacterEncoding=UTF-8, CamelHttpMethod=POST, CamelHttpPath=,
> CamelHttpQuery=null,
> CamelHttpServletRequest=org.apache.catalina.connector.RequestFacade@1350201,
> CamelHttpServletResponse=org.apache.catalina.connector.ResponseFacade@116b42c,
> CamelHttpUri=/customers/neworder,
> CamelHttpUrl=http://localhost:8080/customers/neworder,
> CamelRedelivered=false, CamelRedeliveryCounter=0,
> CamelServletContextPath=/customers/neworder, connection=keep-alive,
> content-length=55, Content-Type=application/json,
> cookie=_pk_id.2.1fff=026a212c399ad03f.1410797639.15.1411684275.1411681543.,
> dnt=1, host=localhost:8080,
> origin=chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo,
> user-agent=Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML,
> like Gecko) Chrome/35.0.1916.153 Safari/537.36}
>         BodyType            org.apache.camel.converter.stream.InputStreamCache
>         Body                [Body is instance of org.apache.camel.StreamCache]
> ]
>
> Stacktrace
> ---------------------------------------------------------------------------------------------------------------------------------------
>
> org.apache.camel.CamelExchangeException: No partition key set.
> Exchange[Message: [Body is instance of org.apache.camel.StreamCache]]
>         at
> org.apache.camel.component.kafka.KafkaProducer.process(KafkaProducer.java:67)
>
>
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-kafka-provider-no-partition-key-tp5759971.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/