Spring consumer does not get invoked.
groovenarula Dec 28, 2010 2:33 AMHello,
For some reason I just can't seem to get my Spring based SessionAwareMessageListener implimentation to consume messages from a 2.1.2.Final HornetQ based queue deployed on JBOSS AS 5.1.0.GA.
I have defined the following queue in hornetq-jms.xml (in default-with-hornetq/deploy/hornetq.sar folder of JBOSS AS) :
<queue name="PriceResponses">
<entry name="/queue/PriceResponses"/>
</queue>
(I've left the reset of the configuration as is).
The consumer is on a Spring based web application that implements 'SessionAwareMessageListener' called MessageReceiver :
public class MessageReceiver implements SessionAwareMessageListener
{
public void onMessage(Message message,Session jmssession) throws JMSException
{
System.out.println("Consumer invoked");
}
}
The MessageReceiver is 'wired' in the 'applicationContext.xml' as follows:
<bean id="PriceResponseQueue" class="org.hornetq.jms.client.HornetQQueue">
<constructor-arg value="PriceResponses" />
</bean>
<bean id="messageListener" class="lzbws.jms.message.MessageReceiver" />
<jms:listener-container container-type="default" connection-factory="jmsConnectionFactory" acknowledge="transacted">
<jms:listener destination="PriceResponseQueue" ref="messageListener" method="onMessage"/>
</jms:listener-container>
Using the jmx-console, I've verified that the queue does have 4 messages waiting to be delivered :
JNDIBindings | R | [Ljava.lang.String; | Attribute exposed for management | /queue/PriceResponses |
Address | R | java.lang.String | Attribute exposed for management | jms.queue.PriceResponses |
Name | R | java.lang.String | Attribute exposed for management | PriceResponses |
Temporary | R | boolean | Attribute exposed for management | False |
MessageCount | R | int | Attribute exposed for management | 4 |
Yet when I start the tomcat application, I don't see any indication that the messages are getting consumed. In fact there's no error / exceptions in the logs either. If I chang the name of the queue (to see what would happen), I do get an exception that the queue was not found. But if the server name/queue details are valid, there are no errors or any addtional messages partaing to the invocation of the consumer in the queue.
The same example works just fine with Jboss Messaging (after switching out the references to the HornetQ queue in the application context above). But it does not work with HornetQ.
Any help will be appreciated as I would really pefer to deploy HornetQ instead of Jboss Messaging. But i'll be forced to stay with HornetQ if I can't get this to work.
Thanks in advance,
Gurvinder