0 Replies Latest reply on Dec 10, 2007 8:02 AM by Reinhard Graf

    redelivering topic messages

    Reinhard Graf Newbie

      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);
      }
      }
      }