Version 12

    What vendor specifc properties does JBossMQ provide?

     

    As of 3.2.2 JBoss provides properties for scheduled delivery and redelivery control.

     

     

    From org.jboss.mq.SpyMessage

     

    ....
       /**
          * JBoss-vendor specific property specifying redelivery delay of a message.
          * The message will be rescheduled for delivery from the time at which it
          * was unacknowledged, plus the given period.
          */
       public static final String PROPERTY_REDELIVERY_DELAY = "JMS_JBOSS_REDELIVERY_DELAY";
    
       /**
          * JBoss-vendor specific property for getting the count of redelivery
          * attempts of a message.
          */
       public static final String PROPERTY_REDELIVERY_COUNT = "JMS_JBOSS_REDELIVERY_COUNT";
    
       /**
          * JBoss-vendor specific property specifying the limit of redelivery
          * attempts of a message. The message will be redelivered a given number of
          * times. If not set, the container default is used.
          */
       public static final String PROPERTY_REDELIVERY_LIMIT = "JMS_JBOSS_REDELIVERY_LIMIT";
    ...
    

     

    Usage

     

                     m.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
    
                     /* JBossMQ specific property - JMS_JBOSS_SCHEDULED_DELIVERY */
                     long ONE_HOUR_MILLIS = 15 * 60 * 1000;
                     long now = System.currentTimeMillis();
                     m.setLongProperty("JMS_JBOSS_SCHEDULED_DELIVERY", now + ONE_HOUR_MILLIS);
    
                      /* JBossMQ specific property - JMS_JBOSS_REDELIVERY_LIMIT */
                     m.setIntProperty("JMS_JBOSS_REDELIVERY_LIMIT", 10);
    

     

     

     

     

    Two equivalent attributes may also be configurated on the destination: RedeliveryLimit and RedeliveryDelay.

     

    Check out this wiki for details: Queue or Topic

     

     

     

     

    NOTE If both the attributes on the destination and the property on the message are set, the ones on the message take precedence.

     

     

     

     

     

     

    Why am I getting this exception and why is my message not sent to the DQL?

     

    2007-01-25 13:50:13,794 ERROR [org.jboss.ejb.plugins.jms.DLQHandler] Could not send message to Dead Letter Queue
    javax.jms.MessageFormatException: Invalid conversion
         at org.jboss.mq.SpyMessage.getIntProperty(SpyMessage.java:574)
         at org.jboss.ejb.plugins.jms.DLQHandler.handleRedeliveredMessage(DLQHandler.java:212)
         at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1370)
         at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256)
         at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:904)
         at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:160)
         at org.jboss.mq.SpySession.run(SpySession.java:333)
         at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
    

     

    Answer

     

    When you set properties on the SpyMessage object, you've got to use the appropriate type. For instance:

     

     

         m.setIntProperty("JMS_JBOSS_REDELIVERY_LIMIT", 10); --> VALID
    
    
         m.setLongProperty("JMS_JBOSS_REDELIVERY_LIMIT", 10); --> INVALID
    

     

     

     

     

     

    Old Reference: Change Note describes the properties.