I beleive my problem has been solved. It was my bad. I was using a selector
consumer = session.createConsumer(destination, selector, false); but when
dispatching the message from the ejb, I did not specify a property on the
message. Thus the consumer did not pick it up.
CobraTheSleek wrote:
>
> Hi James, thanks much for the response. In my sender code, if I do an
> explicit commit() on the session, I receive the following message as an XA
> transaction is in progress:
>
> 08:35:57,390 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
> 08:35:57,390 ERROR [STDERR] Caused by:
> javax.jms.TransactionInProgressException:
> Cannot commit() if an XA transaction is already in progress
> 08:35:57,390 ERROR [STDERR] at
> org.apache.activemq.TransactionContext.commit
> (TransactionContext.java:249)
> 08:35:57,390 ERROR [STDERR] at
> org.apache.activemq.ra.ManagedTransactionCont
> ext.commit(ManagedTransactionContext.java:62)
> 08:35:57,390 ERROR [STDERR] at
> org.apache.activemq.ActiveMQSession.commit(Ac
> tiveMQSession.java:494)
> 08:35:57,390 ERROR [STDERR] at
> org.apache.activemq.ra.ManagedSessionProxy.co
> mmit(ManagedSessionProxy.java:101)
> 08:35:57,406 ERROR [STDERR] at
> org.apache.activemq.ActiveMQQueueSession.comm
> it(ActiveMQQueueSession.java:72)
>
>
> If, I change the code to not send a transacted message, i.e.,
> QueueSession qsession = qcon.createQueueSession(false, 0); I still do not
> see the message on my onMessage.
>
> On my Consumer from the spring example, I am setting a transacted session,
> i.e.,
> try {
> ConnectionFactory factory = template.getConnectionFactory();
> connection = factory.createConnection();
>
> // we might be a reusable connection in spring
> // so lets only set the client ID once if its not set
> synchronized (connection) {
> if (connection.getClientID() == null) {
> connection.setClientID(myId);
> }
> }
> connection.start();
>
> session = connection.createSession(true,
> Session.AUTO_ACKNOWLEDGE);
> consumer = session.createConsumer(destination, selector,
> false);
> consumer.setMessageListener(this);
>
> If I however change it to be non-transacted on the Spring consumer, I
> still do not receive the messages.
>
> Thanks in advance for any assitance.
>
>
> James.Strachan wrote:
>>
>> It looks like you're creating a transactional session and never
>> calling commit().
>>
>> On 09/11/2007, CobraTheSleek <[EMAIL PROTECTED]> wrote:
>>>
>>> Hi,
>>>
>>> ENV:
>>> ActiveMQ-Snapshot-5.0
>>> JBoss AS 4.2.1
>>>
>>> I have the following queues defined:
>>>
>>> <mbean code="org.jboss.resource.deployment.AdminObject"
>>> name="activemq.queue:name=org.apache.activemq.requestQueue">
>>> <attribute name="JNDIName">activemq/requestQueue</attribute>
>>> <depends
>>> optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='activemq-ra.rar'</depends>
>>> <attribute name="Type">javax.jms.Queue</attribute>
>>> <attribute
>>> name="Properties">PhysicalName=org.apache.activemq.requestQueue</attribute>
>>> </mbean>
>>>
>>> <mbean code="org.jboss.resource.deployment.AdminObject"
>>> name="activemq.queue:name=org.apache.activemq.replyQueue">
>>> <attribute
>>> name="JNDIName">activemq/echoResponseQueue</attribute>
>>> <depends
>>> optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='activemq-ra.rar'</depends>
>>> <attribute name="Type">javax.jms.Queue</attribute>
>>> <attribute
>>> name="Properties">PhysicalName=org.apache.activemq.replyQueue</attribute>
>>> </mbean>
>>>
>>> I have an MDB defined that listens for messages from the requestQueue
>>> and
>>> posts a response on the replyQueue.
>>>
>>> I am using the Spring unit tests provided (Producer and Consumer) and my
>>> Producer sends messages to the requestQueue, the MDB receives the
>>> request
>>> and posts a message back on to the replyQueue.
>>>
>>> I can see that there are messages in the replyQueue via JMX. However, my
>>> Consumer never receives messages from the replyQueue.
>>>
>>> If I run the test without the MDB, by placing messages in the replyQueue
>>> via
>>> the PRODUCER, my Consumer receives the messages successfully. In other
>>> words
>>> messages posted by the MDB are never received by the consumer.
>>>
>>> The following is what my MDB does to place messages back on the reply
>>> queue:
>>>
>>> InitialContext initCtx = new InitialContext();
>>>
>>> QueueConnectionFactory qcf = (QueueConnectionFactory) initCtx
>>> .lookup("java:comp/env/jms/MyQueueConnectionFactory");
>>>
>>> QueueConnection qcon = qcf.createQueueConnection();
>>> QueueSession qsession = qcon.createQueueSession(true, 0);
>>> Queue q = (Queue) initCtx.lookup("activemq/replyQueue");
>>> QueueSender qsender = qsession.createSender(q);
>>>
>>> TextMessage message = qsession.createTextMessage();
>>>
>>> message.setText(response);
>>> qsender.setTimeToLive(100000000);
>>> qsender.send(message);
>>>
>>> qsender.close();
>>> qsession.close();
>>> qcon.close();
>>>
>>>
>>> I am quite confused as to why this is happening as I see messages as
>>> being
>>> available in the replyQueue.
>>> Any tips would be appreciated.
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Messages-not-being-received-by-consumer-tf4779201s2354.html#a13672078
>>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>> --
>> James
>> -------
>> http://macstrac.blogspot.com/
>>
>> Open Source SOA
>> http://open.iona.com
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/Messages-not-being-received-by-consumer-tf4779201s2354.html#a13738207
Sent from the ActiveMQ - User mailing list archive at Nabble.com.