[jboss-user] [JBoss Messaging] - Redelivering topic messages

reinhard.graf do-not-reply at jboss.com
Mon Dec 10 05:02:35 EST 2007


Hi,

I'm using JBoss 4.0.5 GA and MDB with EJB3.

The MDB ist listening to a topic with a durable subscription.

On error, I rollback the transcation in the onMessage method - but the message is never redelivered - please can anybody help me ?

@MessageDriven(activationConfig={
		@ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Topic"),
		@ActivationConfigProperty(propertyName="destination", propertyValue="topic/STATECHANGE"),
		@ActivationConfigProperty(propertyName="subscriptionDurability", propertyValue="Durable"),
		@ActivationConfigProperty(propertyName="subscriptionName", propertyValue="DispoStateChangeListener"),
		@ActivationConfigProperty(propertyName="sessionTransacted", propertyValue="true"),
		@ActivationConfigProperty(propertyName="clientId", propertyValue="DispoStateChangeListenerID"),
		@ActivationConfigProperty(propertyName="durable", propertyValue="true")
		
})
public class StateChangeNotificationListener implements MessageListener {
	
	@EJB(name=DispoFacadeLocal.LOCAL_JNDI)
	private DispoFacadeLocal dispoFacade;
	
	@Resource private MessageDrivenContext context;
	
	private Logger logger = Logger.getLogger(StateChangeNotificationListener.class);
	
	@TransactionAttribute(value=TransactionAttributeType.REQUIRED)
	public void onMessage(Message message) {
		if (message instanceof MapMessage) {
			try {
				MapMessage mapMessage = (MapMessage) message;
				if (mapMessage.getBoolean(StateChangedParameter.ORDERTASK)) {

				.......
						if (handleNotification(parameter)) {
						message.acknowledge();
					} else {
						context.setRollbackOnly();
					}
				} else {
					message.acknowledge();
				} 
			} catch (JMSException ex) {
				logger.error("error receiving message: ", ex);
			} catch (BusinessException ex) {
				logger.error(ex);
			}
		}
	}

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111549#4111549

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111549



More information about the jboss-user mailing list