Message redelivery not working in 4.0.1sp1
cookserr Jul 26, 2005 3:55 PMMessage redelivery doesn't seem to be working in 4.0.1sp1. The twist is that the same code base works in 4.0 and 4.0.2.
ejb-jar.xml contents
<message-driven>
<display-name>EventHandlerMDB</display-name>
<ejb-name>EventHandlerMDB</ejb-name>
<ejb-class>com.nielsenmedia.services.events.EventHandlerMDB</ejb-class>
<transaction-type>Container</transaction-type>
<acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
<message-driven-destination>
<destination-type>javax.jms.Queue</destination-type>
<subscription-durability>NonDurable</subscription-durability>
</message-driven-destination>
</message-driven>
<assembly-descriptor>
<container-transaction>
<ejb-name>EventHandlerMDB</ejb-name>
<method-name>onMessage</method-name>
<method-params>
<method-param>javax.jms.Message</method-param>
</method-params>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
mdb code:
public void onMessage(javax.jms.Message message) throws EJBException {
ObjectMessage objectMessage = (ObjectMessage)message;
try {
if (objectMessage.getObject() instanceof Event) {
Event event = (Event)objectMessage.getObject();
log.info("Received event of type " + event.getEventType());
...
}
} catch (Exception e) {
messageContext.setRollbackOnly();
log.severe("Failed to process event: " + ServicesException.getPrintStackTraceAsString(e));
}
Client code:
public static void postMessage(String queueConnectionFactory, String queueName, Serializable object, String url) throws Exception{
Connection connection = null;
try {
Context jndiContext = getContext(url);
connection = getConnection(jndiContext, queueConnectionFactory);
Destination destination = (Queue) jndiContext.lookup(queueName);
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer messageProducer = session.createProducer(destination);
ObjectMessage message = session.createObjectMessage();
message.setObject(object);
messageProducer.send(message);
}catch (Exception e) {
log.info(ServicesException.getPrintStackTraceAsString(e));
throw e;
}finally{
if (connection != null )
connection.close();
}
When restarting jboss the logs would seem to indicate that the messages still reside in persistant storage (hypersonic in this case). Interesting that the redelivery count is greater than the limit.
15:42:54,573 WARN [AbstractDLQHandler] Message redelivered=10 max=3 sending it
to the dlq org.jboss.mq.SpyObjectMessage {
Header {
jmsDestination : QUEUE.EventsQueue
jmsDeliveryMode : 2
jmsExpiration : 0
jmsPriority : 4
jmsMessageID : ID:3-11223164246971
jmsTimeStamp : 1122316424697
jmsCorrelationID: null
jmsReplyTo : null
jmsType : null
jmsRedelivered : true
jmsProperties : {JMS_JBOSS_REDELIVERY_COUNT=10, JMS_JBOSS_REDELIVERY_LIMIT=
3}
jmsPropReadWrite: false
msgReadOnly : true
producerClientId: ID:3
}
A little help would be appreciated (going back to 4.0 or upgrading to 4.0.2 not an option as this time)