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.

Reply via email to