camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: problems when call Kafka api
Date Sun, 04 Dec 2016 01:52:42 GMT
Hi,

I cannot see any wrong with route.
You may need to check if the message body is right by using a TCP or HTTP
proxy.
It's helpful for us to find out which part is exactly wrong.



Willem Jiang

Blog: http://willemjiang.blogspot.com (English)
          http://jnn.iteye.com  (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem

On Sat, Dec 3, 2016 at 10:13 AM, meng <tianmeng000@gmail.com> wrote:

> Hi,
>
> I'm trying to call a Kafka server and publish an event to my topic.
> For the Kafka server has been warped, I assume I just need to call it as
> other rest server.
>
> Here is my code:
> from("direct:toKafka")
>                 .marshal()
>                 .string("UTF-8")
>
>                 .setHeader("Accept", simple("application/json"))
>                 .setHeader(Exchange.HTTP_METHOD, HttpMethods.POST)
>                 .setHeader(Exchange.CONTENT_TYPE,
> simple("application/json"))
>                 .to("http://event.com:8080/v1/topics/test:publish")
>
> But it returns 400 error.
>
> There is no error at the server side, for when I use the curl to call it,
> it
> works well.
> Here is my curl command:
> curl -X POST --header 'Content-Type: application/json' --header 'Accept:
> application/json' -d '[
>   {
>    myjson
>   }
> ]' 'http://event.com:8080/v1/topics/test:publish'
>
> Any idea?
>
> Thanks,
> Meng
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/problems-when-call-Kafka-api-tp5790965.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message