You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Jakub Moskal <ja...@gmail.com> on 2010/11/29 17:54:58 UTC

ActiveMQ String messages get dropped?

Hi,

I just started using Camel because apparently this is the way to go if
I need to reorder messages by their priority in the ActiveMQ.

Here is my setup:
Two producers (A and B) publish to OUT topic. Producer A sends
messages with priority 4, producer B with priority 9. There is one
subscriber that consumes messages from OUT. Ideally, all messages from
producer B are consumed almost immediately (they occur far les
frequently than those from A).

I configured a resequencer between OUT and OUT_ORDERED and configured
the subscriber to consume from the ordered topic. It didn't seem to
work, only B messages were consumed, all messages from A were dropped.
I configured camel this way:

context = new DefaultCamelContext();
context.addComponent("jms",
ActiveMQComponentactiveMQComponent("tcp://localhost:61616"));

context.addRoutes(new RouteBuilder() {
public void configure() throws Exception {
  from("jms:topic:" +
OUT_BUFFER).resequence(header("JMSPriority")).batch().timeout(TIMEOUT).allowDuplicates().reverse().to("jms:topic:"
+ OUT_ORDERED_BUFFER);
}

To ensure it's not the lower priority that caused messages to be
dropped, I gave producer A the same priority as B, ie. 9. The result
was the same, only B messages made it to the ordered topic. I made
this even simpler and configured the route simply as:

from("jms:topic:" + OUT_BUFFER).to("jms:topic:" + OUT_ORDERED_BUFFER);

Strangely enough, this didn't work either, only B messages were consumed.

I then realized that producer A sends plain Strings (using
producer.send(session.createObjectMessage(messageContent)), and
producer B sends custom serializable objects. That was the only
difference between these producers, so I created another custom
serializable class and made producer A publish its messages wrapped in
these objects. That worked, although very sluggishly, but both A and B
messages were consumed in the ordered buffer.

Finally my question, is there a reason why Camel drops String
messages? Is there something wrong in my setup perhaps?

Thanks for help!
Jakub

Re: ActiveMQ String messages get dropped?

Posted by Claus Ibsen <cl...@gmail.com>.
Read about limitations and JMS properties
http://camel.apache.org/jms

The JMS spec is a bit rigid what and how can be send as JMS properties.


On Mon, Nov 29, 2010 at 5:54 PM, Jakub Moskal <ja...@gmail.com> wrote:
> Hi,
>
> I just started using Camel because apparently this is the way to go if
> I need to reorder messages by their priority in the ActiveMQ.
>
> Here is my setup:
> Two producers (A and B) publish to OUT topic. Producer A sends
> messages with priority 4, producer B with priority 9. There is one
> subscriber that consumes messages from OUT. Ideally, all messages from
> producer B are consumed almost immediately (they occur far les
> frequently than those from A).
>
> I configured a resequencer between OUT and OUT_ORDERED and configured
> the subscriber to consume from the ordered topic. It didn't seem to
> work, only B messages were consumed, all messages from A were dropped.
> I configured camel this way:
>
> context = new DefaultCamelContext();
> context.addComponent("jms",
> ActiveMQComponentactiveMQComponent("tcp://localhost:61616"));
>
> context.addRoutes(new RouteBuilder() {
> public void configure() throws Exception {
>  from("jms:topic:" +
> OUT_BUFFER).resequence(header("JMSPriority")).batch().timeout(TIMEOUT).allowDuplicates().reverse().to("jms:topic:"
> + OUT_ORDERED_BUFFER);
> }
>
> To ensure it's not the lower priority that caused messages to be
> dropped, I gave producer A the same priority as B, ie. 9. The result
> was the same, only B messages made it to the ordered topic. I made
> this even simpler and configured the route simply as:
>
> from("jms:topic:" + OUT_BUFFER).to("jms:topic:" + OUT_ORDERED_BUFFER);
>
> Strangely enough, this didn't work either, only B messages were consumed.
>
> I then realized that producer A sends plain Strings (using
> producer.send(session.createObjectMessage(messageContent)), and
> producer B sends custom serializable objects. That was the only
> difference between these producers, so I created another custom
> serializable class and made producer A publish its messages wrapped in
> these objects. That worked, although very sluggishly, but both A and B
> messages were consumed in the ordered buffer.
>
> Finally my question, is there a reason why Camel drops String
> messages? Is there something wrong in my setup perhaps?
>
> Thanks for help!
> Jakub
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/