ActiveMQ message not dequeued for a single route with multiple queues

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

ActiveMQ message not dequeued for a single route with multiple queues

malcolm davis
I'm not sure if the following is a bug that needs to be reported, and that I'm missing something obvious.

For a single route with multiple JMS queues, the first queue is properly dequeued, but the remaining routes do not have the ActiveMQ message dequeued.
a.  Messages flow through the system to completion.
b.  If the single route is decomposed into multiple camel routes, the messages are properly dequeued.
c.  The issue occurs for both SjmsComponent and JmsComponent
d.  The issue occurs for both auto acknowledge and client acknowledge.

In the following route, the file written at the end is correct, but messages are still in queues DEMO.TRANSFORM.1 and DEMO.TRANSFORM.2

from("activemq:queue:DEMO.IN")
.process( new org.apache.camel.Processor() {
        @Override
        public void process(Exchange exchange) throws Exception {
                exchange.getOut().setBody(exchange.getIn().getBody().toString() + "<in>step 1</in>");
        }
})
.to("activemq:queue:DEMO.TRANSFORM.1")
.process( new org.apache.camel.Processor() {
        @Override
        public void process(Exchange exchange) throws Exception {
                exchange.getOut().setBody(exchange.getIn().getBody().toString() + "<transform1>true</transform1>");
        }
})
.to("activemq:queue:DEMO.TRANSFORM.2")
.process( new org.apache.camel.Processor() {
        @Override
        public void process(Exchange exchange) throws Exception {
                exchange.getOut().setBody(exchange.getIn().getBody().toString() + "<transform2>true</transform2>");
        }
})
.to("file://c:/temp/DEMO.FINISHED");
Reply | Threaded
Open this post in threaded view
|

Re: ActiveMQ message not dequeued for a single route with multiple queues

malcolm.davis
The code fails the same way with Tibco-EMS.

This looks like a Camel bug.

Reply | Threaded
Open this post in threaded view
|

Re: ActiveMQ message not dequeued for a single route with multiple queues

Minh Tran
In reply to this post by malcolm davis
I'm not certain but I doubt the behaviour of putting in JMS in the middle of a route would be to both consume a message and then immediately pass pack the message straight off the JMS destination. I would expect it to simply pass back the message unchanged and leave the message alone on the destination, I'm pretty sure this isn't what you want to achieve.

IMO JMS components only make sense at the beginning of or at the end of a route.

On 28/04/2014, at 3:35 AM, malcolm davis <[hidden email]> wrote:

> I'm not sure if the following is a bug that needs to be reported, and that
> I'm missing something obvious.
>
> For a single route with multiple JMS queues, the first queue is properly
> dequeued, but the remaining routes do not have the ActiveMQ message
> dequeued.
> a.  Messages flow through the system to completion.
> b.  If the single route is decomposed into multiple camel routes, the
> messages are properly dequeued.
> c.  The issue occurs for both SjmsComponent and JmsComponent
> d.  The issue occurs for both auto acknowledge and client acknowledge.
>
> In the following route, the file written at the end is correct, but messages
> are still in queues DEMO.TRANSFORM.1 and DEMO.TRANSFORM.2
>
> from("activemq:queue:DEMO.IN")
> .process( new org.apache.camel.Processor() {
> @Override
> public void process(Exchange exchange) throws Exception {
> exchange.getOut().setBody(exchange.getIn().getBody().toString() +
> "<in>step 1</in>");
> }
> })
> .to("activemq:queue:DEMO.TRANSFORM.1")
> .process( new org.apache.camel.Processor() {
> @Override
> public void process(Exchange exchange) throws Exception {
> exchange.getOut().setBody(exchange.getIn().getBody().toString() +
> "<transform1>true</transform1>");
> }
> })
> .to("activemq:queue:DEMO.TRANSFORM.2")
> .process( new org.apache.camel.Processor() {
> @Override
> public void process(Exchange exchange) throws Exception {
> exchange.getOut().setBody(exchange.getIn().getBody().toString() +
> "<transform2>true</transform2>");
> }
> })
> .to("file://c:/temp/DEMO.FINISHED");
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/ActiveMQ-message-not-dequeued-for-a-single-route-with-multiple-queues-tp5750631.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: ActiveMQ message not dequeued for a single route with multiple queues

Claus Ibsen-2
In reply to this post by malcolm davis
See this FAQ
http://camel.apache.org/using-getin-or-getout-methods-on-exchange.html

Just use getIn()

On Sun, Apr 27, 2014 at 7:35 PM, malcolm davis <[hidden email]> wrote:

> I'm not sure if the following is a bug that needs to be reported, and that
> I'm missing something obvious.
>
> For a single route with multiple JMS queues, the first queue is properly
> dequeued, but the remaining routes do not have the ActiveMQ message
> dequeued.
> a.  Messages flow through the system to completion.
> b.  If the single route is decomposed into multiple camel routes, the
> messages are properly dequeued.
> c.  The issue occurs for both SjmsComponent and JmsComponent
> d.  The issue occurs for both auto acknowledge and client acknowledge.
>
> In the following route, the file written at the end is correct, but messages
> are still in queues DEMO.TRANSFORM.1 and DEMO.TRANSFORM.2
>
> from("activemq:queue:DEMO.IN")
> .process( new org.apache.camel.Processor() {
>         @Override
>         public void process(Exchange exchange) throws Exception {
>                 exchange.getOut().setBody(exchange.getIn().getBody().toString() +
> "<in>step 1</in>");
>         }
> })
> .to("activemq:queue:DEMO.TRANSFORM.1")
> .process( new org.apache.camel.Processor() {
>         @Override
>         public void process(Exchange exchange) throws Exception {
>                 exchange.getOut().setBody(exchange.getIn().getBody().toString() +
> "<transform1>true</transform1>");
>         }
> })
> .to("activemq:queue:DEMO.TRANSFORM.2")
> .process( new org.apache.camel.Processor() {
>         @Override
>         public void process(Exchange exchange) throws Exception {
>                 exchange.getOut().setBody(exchange.getIn().getBody().toString() +
> "<transform2>true</transform2>");
>         }
> })
> .to("file://c:/temp/DEMO.FINISHED");
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/ActiveMQ-message-not-dequeued-for-a-single-route-with-multiple-queues-tp5750631.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [hidden email]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/
Reply | Threaded
Open this post in threaded view
|

Re: ActiveMQ message not dequeued for a single route with multiple queues

malcolm davis
Thanks for the quick feedback.

Based on previous queuing and jms experience, I prefer a pipe and queue technique.

Pipes and queues is a common technique, and I was introduced to the approach prior to the creation of jms.

I don't mind that Camel does have a practically way of applying the method, other than wrapping every process in it's own route.

Thanks again,
Malcolm
Reply | Threaded
Open this post in threaded view
|

Re: ActiveMQ message not dequeued for a single route with multiple queues

ceposta
Yah I think it's working as designed. "To" sends to an external system.

On Sat, May 10, 2014 at 10:27 AM, malcolm davis <[hidden email]> wrote:

> Thanks for the quick feedback.
>
> Based on previous queuing and jms experience, I prefer a pipe and queue
> technique.
>
> Pipes and queues is a common technique, and I was introduced to the approach
> prior to the creation of jms.
>
> I don't mind that Camel does have a practically way of applying the method,
> other than wrapping every process in it's own route.
>
> Thanks again,
> Malcolm
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/ActiveMQ-message-not-dequeued-for-a-single-route-with-multiple-queues-tp5750631p5750968.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Christian Posta
http://www.christianposta.com/blog
twitter: @christianposta