You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by gupabhi <ab...@morganstanley.com> on 2008/04/18 17:37:20 UTC

Creating queue and accessing them through different session

Hi,
    I'm new to ActiveMQ. Here is my usecase:  I want to create a queue using
a non-transacted session. Put in a message in that queue.  And then access
the message from that queue from a different transacted session.

To put in the message I do:
nonTxSession = (QueueSession) queueConnection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
requestQueue = session.createQueue("REQUEST");
requestQueueSender = nonTxSession .createSender(requestQueue);
Message message = getCurrentSession().createTextMessage("MyMsg");
qs.send( message );


I receive the message through Springs DefaultMessageListernerContainer, with
a JMSTransactionManager in it. 
So bascially, it creates a consumer with the same name as the requestQueue
above ("REQUEST").
But the receive return with a "null".

What am I missing?

Thanks,
Abhi

P.S. I'm using version 4.1. Does that make a diff?




-- 
View this message in context: http://www.nabble.com/Creating-queue-and-accessing-them-through-different-session-tp16763515s2354p16763515.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Creating queue and accessing them through different session

Posted by j0llyr0g3r <ti...@wincor-nixdorf.com>.
Hi,

i am not sure, but i think the JMS specification forbids something like this
(JMS specifiation chapter 4.4.7)....


-- 
View this message in context: http://www.nabble.com/Creating-queue-and-accessing-them-through-different-session-tp16763515s2354p16833980.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Creating queue and accessing them through different session

Posted by James Strachan <ja...@gmail.com>.
On 18/04/2008, gupabhi <ab...@morganstanley.com> wrote:
>
>  Hi,
>     I'm new to ActiveMQ. Here is my usecase:  I want to create a queue using
>  a non-transacted session. Put in a message in that queue.  And then access
>  the message from that queue from a different transacted session.
>
>  To put in the message I do:
>  nonTxSession = (QueueSession) queueConnection.createSession(false,
>  Session.AUTO_ACKNOWLEDGE);
>  requestQueue = session.createQueue("REQUEST");
>  requestQueueSender = nonTxSession .createSender(requestQueue);
>  Message message = getCurrentSession().createTextMessage("MyMsg");
>  qs.send( message );
>
>
>  I receive the message through Springs DefaultMessageListernerContainer, with
>  a JMSTransactionManager in it.
>  So bascially, it creates a consumer with the same name as the requestQueue
>  above ("REQUEST").
>  But the receive return with a "null".

I don't follow - there's no Message object - or the payload is empty?

What you describe should work - its normal JMS to send a message to a
queue and then consume it later on with a different session

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com