You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by scottdawson <sc...@gmail.com> on 2014/02/13 22:56:36 UTC
Jetty endpoint as ActiveMQ consumer
Hello,
I want to consume messages from an ActiveMQ queue using HTTP GET via a Jetty
endpoint. This will deploy:
<route>
<from uri="jetty:http://0.0.0.0:8182/dequeue"/>
<from uri="activemq:queue:cds-response"/>
<log message="*** ${headers.JMSCorrelationID}"/>
</route>
but the second "from" doesn't wait on the first "from", in other words,
messages are consumed from the queue as soon as they arrive, not when the
Jetty endpoint is called. (If I leave out the log line, I get an error
because "Route has no outputs".)
So, my basic question is... how do I invoke a consumer from another
consumer?
Thanks,
Scott
--
View this message in context: http://camel.465427.n5.nabble.com/Jetty-endpoint-as-ActiveMQ-consumer-tp5747278.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Jetty endpoint as ActiveMQ consumer
Posted by scottdawson <sc...@gmail.com>.
Thanks Willem. Great insight. For anyone else reading this, this is how you
can retrieve from the JMS queue to provide the response for the HTTP GET:
<from uri="jetty:http://0.0.0.0:8182/dequeue"/>
<pollEnrich uri="activemq:queue:cds-response" timeout="2000"/>
Best regards,
Scott
--
View this message in context: http://camel.465427.n5.nabble.com/Jetty-endpoint-as-ActiveMQ-consumer-tp5747278p5747348.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Jetty endpoint as ActiveMQ consumer
Posted by Willem Jiang <wi...@gmail.com>.
Hi,
I bet this page[1] can help you :)
[1] http://camel.apache.org/content-enricher.html
--
Willem Jiang
Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com(http://willemjiang.blogspot.com/) (English)
http://jnn.iteye.com(http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem
On February 14, 2014 at 5:57:06 AM, scottdawson (sc.e.dawson@gmail.com) wrote:
>
> Hello,
> I want to consume messages from an ActiveMQ queue using HTTP GET
> via a Jetty
> endpoint. This will deploy:
>
>
>
>
>
>
> but the second "from" doesn't wait on the first "from", in other
> words,
> messages are consumed from the queue as soon as they arrive, not
> when the
> Jetty endpoint is called. (If I leave out the log line, I get an
> error
> because "Route has no outputs".)
>
> So, my basic question is... how do I invoke a consumer from another
> consumer?
>
> Thanks,
> Scott
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Jetty-endpoint-as-ActiveMQ-consumer-tp5747278.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: Jetty endpoint as ActiveMQ consumer
Posted by Reji Mathews <co...@gmail.com>.
Hi Scott
Thumb Rule is that you cant have more than 1 consumer endpoint ("from") in
a route tag. I would suggest you to have a route take data from Queues and
sent it as an http request.
And another route to grab that (set up a jetty http server point here) and
continue what ever processing you wanna carry out.. Store the contents you
retrieve from the queue into an http parameter and pass it.
On Fri, Feb 14, 2014 at 3:26 AM, scottdawson <sc...@gmail.com> wrote:
> Hello,
> I want to consume messages from an ActiveMQ queue using HTTP GET via a
> Jetty
> endpoint. This will deploy:
> <route>
> <from uri="jetty:http://0.0.0.0:8182/dequeue"/>
> <from uri="activemq:queue:cds-response"/>
> <log message="*** ${headers.JMSCorrelationID}"/>
> </route>
>
> but the second "from" doesn't wait on the first "from", in other words,
> messages are consumed from the queue as soon as they arrive, not when the
> Jetty endpoint is called. (If I leave out the log line, I get an error
> because "Route has no outputs".)
>
> So, my basic question is... how do I invoke a consumer from another
> consumer?
>
> Thanks,
> Scott
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Jetty-endpoint-as-ActiveMQ-consumer-tp5747278.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>