Re: problems when call Kafka api

2016-12-03 Thread Willem Jiang
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  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.
>


Re: Camel Help

2016-12-03 Thread souciance
If you have bought the license for it I suggest it is better to ask Red Hat
about it.

In general I think the graphical tool, although quite useful and nice, will
probably require a few versions until it is stable enough for everyday use.
I think there is a graphical mapper also released that you can test. It was
the same for other graphical based tools such as IBM's WMB which didn't
really because a stable until version 7 and 8.

I can tell you that once you get familar with the java dsl there isn't that
much code to write. What takes time is knowing how to organize your routes,
increase performance and stuff like that. Those things you would need to do
regardless of which approach you use.

On Sun, Dec 4, 2016 at 12:40 AM, kaiser75 [via Camel] <
ml-node+s465427n5790971...@n5.nabble.com> wrote:

> I am doing the simple examples first.  As far the my rest service is
> considered, it will invoked by one of our internal systems.  I understand
> that you can code it using the Java DSL but I was trying to avoid it and I
> wanted to see if I can orchestrate the flow I mentioned graphically using
> the fuse IDE, I have not had any luck doing it.
>
> souciance wrote
> Hello,
>
> Well, how far have you got so far?
>
> Basically, Camel in a very simple way tries to make the connection between
> the sender and receiver as simple as possible and is based on various
> components. So you have a component for http, another for rest, another
> for
> transform and another for rabbitmq. You then have to use these and
> "connect
> the dots" to get a fully functioning publisher and consumer. So your
> consumer can be something like:
>
> from("rabbitmq://localhost?yourExchange)
> .choice()
>   .when(header("someheader")
> .isEqualTo("someValue)
> .to("someendpoint")
>   .otherwise()
>   .("someotherendpoint)
> end();
>
> I have not filled in all the parameters for routing key and the subscriber
> queue. You can find more details on the Camel rabbitmq page.
>
> As for your publisher. How will your publisher be triggered? Something
> needs to trigger that http post.
>
> I would say best approach is to not start building your project. Start
> with
> a hello world example and then move to more complicated scenarios. Build a
> simple file transfer example. Just move a file from one folder to another.
> Once you figured that out you understand the basics and can then move to
> more complicated scenarios.
>
> Best
> Souciance
>
>
>
> On Sat, Dec 3, 2016 at 6:47 PM, kaiser75 [via Camel] <
> [hidden email] >
> wrote:
>
> > Hello,
> >
> > I'm going thru the camel in action book , its informative but not very
> > prescriptive.  I'm looking to a build a simple publisher and consumer
> flow
> > using the Fuse opensource IDE with minimum coding, but there are so many
> > ways of doing of what I need but not much clarity on the how to. Can
> > somebody  please shed some light on it.
> >
> > My publisher would be something like this
> >
> > http post -> Rest Service -> transform -> write to RabbitMQ
> >
> > My consumer is
> >
> > Read from RMQ -> Route to other RMQ's based on content
> >
> > Any help in guiding me is much appreciated.
> >
> > Thanks
> > Kaiser
> >
> >
> > --
> > If you reply to this email, your message will be added to the discussion
> > below:
> > http://camel.465427.n5.nabble.com/Camel-Help-tp5790968.html
> > To start a new topic under Camel - Users, email
> > [hidden email] 
> > To unsubscribe from Camel - Users, click here
> >  unsubscribe_by_code=465428=c291Y2lhbmNlLmVxZGFtLnJhc2h0aU
> BnbWFpbC5jb218NDY1NDI4fDE1MzI5MTE2NTY=>
> > .
> > NAML
> >  viewer=instant_html%21nabble%3Aemail.naml=nabble.naml.namespaces.
> BasicNamespace-nabble.view.web.template.NabbleNamespace-
> nabble.view.web.template.NodeNamespace=
> notify_subscribers%21nabble%3Aemail.naml-instant_emails%
> 21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
> 
> >
>
>
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/Camel-Help-tp5790968p5790971.html
> To start a new topic under Camel - Users, email
> ml-node+s465427n465428...@n5.nabble.com
> To unsubscribe from Camel - Users, click here
> 

Re: Camel Help

2016-12-03 Thread souciance
Hello,

Well, how far have you got so far?

Basically, Camel in a very simple way tries to make the connection between
the sender and receiver as simple as possible and is based on various
components. So you have a component for http, another for rest, another for
transform and another for rabbitmq. You then have to use these and "connect
the dots" to get a fully functioning publisher and consumer. So your
consumer can be something like:

from("rabbitmq://localhost?yourExchange)
.choice()
  .when(header("someheader")
.isEqualTo("someValue)
.to("someendpoint")
  .otherwise()
  .("someotherendpoint)
end();

I have not filled in all the parameters for routing key and the subscriber
queue. You can find more details on the Camel rabbitmq page.

As for your publisher. How will your publisher be triggered? Something
needs to trigger that http post.

I would say best approach is to not start building your project. Start with
a hello world example and then move to more complicated scenarios. Build a
simple file transfer example. Just move a file from one folder to another.
Once you figured that out you understand the basics and can then move to
more complicated scenarios.

Best
Souciance



On Sat, Dec 3, 2016 at 6:47 PM, kaiser75 [via Camel] <
ml-node+s465427n5790968...@n5.nabble.com> wrote:

> Hello,
>
> I'm going thru the camel in action book , its informative but not very
> prescriptive.  I'm looking to a build a simple publisher and consumer flow
> using the Fuse opensource IDE with minimum coding, but there are so many
> ways of doing of what I need but not much clarity on the how to. Can
> somebody  please shed some light on it.
>
> My publisher would be something like this
>
> http post -> Rest Service -> transform -> write to RabbitMQ
>
> My consumer is
>
> Read from RMQ -> Route to other RMQ's based on content
>
> Any help in guiding me is much appreciated.
>
> Thanks
> Kaiser
>
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/Camel-Help-tp5790968.html
> To start a new topic under Camel - Users, email
> ml-node+s465427n465428...@n5.nabble.com
> To unsubscribe from Camel - Users, click here
> 
> .
> NAML
> 
>




--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Help-tp5790968p5790970.html
Sent from the Camel - Users mailing list archive at Nabble.com.

problems when call Kafka api

2016-12-03 Thread meng
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.