activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From BenXS <>
Subject How to forward a full message received in Java by onMessage() into another queue?
Date Fri, 13 Aug 2010 11:40:05 GMT

Assume I wrote a Java bean (configured by Spring) which receives successfully
incoming messages on a certain queue. So the "onMessage()" method looks
similar like:

public void onMessage(Message message) {
Now I want to forward/sent the just received message into another queue
"bbbqueue" on the 
same MessageBroker. 

Yes, I know, this can be done much easier by tools like Camel but my
described scenario above 
is a much simplfied version of a complex application. So I have/want to use
a java bean for this.

I just want to know how to put an already prepared message into another
queue with a MINIMUM of overhead.
Keep in mind that the FULL JMS message should be forwarded. That means the
actual payload body AND
all the JMS header (properties).

It must be something similar to:

public void onMessage(Message message) {
   this.send("bbbqueue", message);

Unfortuenately the code above does not work.
How else can I code this?

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message