Version 4

    By default, JBossMQ silently removes expired JMS message from its destination. As of JBoss 4.0.4 and 3.2.8, expired messages can now be moved into a separate destination.


    There are two ways to configure this feature:  Either per Queue or Topic or by DestinationManager MBean.  If set on the DestinationManager, every Queue and Topic by default will use the configured expiry destination.


    The MBean  attribute ExpiryDestination indicates the of the expiry destination.  This destination must be located on the same server and be a JBossMQ destination.


    In this example jboss-service.xml configuration, expired messages on queue "D" will be moved to the "ex" queue:


      <mbean code=""
        <depends optional-attribute-name="DestinationManager"></depends>
        <depends optional-attribute-name="ExpiryDestination">,name=ex</depends>


    This is how the expiry destination is indicated when configured on the

    destination manager:

      <mbean code="" name="">
        <depends optional-attribute-name="MessageCache"></depends>
        <depends optional-attribute-name="PersistenceManager"></depends>
        <depends optional-attribute-name="StateManager"></depends>
        <depends optional-attribute-name="ExpiryDestination">,name=ex</depends>

    Once moved, messages can be processed using a simple javax.jms.MessageConsumer or a MDB.  The original destination is indicated by the javax.jms.Message property "JBOSS_ORIG_DESTINATION" and the time of expiration is indicated with "JBOSS_ORIG_EXPIRATION".  These constants are defined in  The destination is a String property set to the value of Message.getJMSDestination().toString() and expiration time is indicated as a Long property set from Message.getJMSExpiration().


    The expiry destination cannot be changed when the queue or topic is active.


    Errors:  If the expiry destination is unavailable or an error occurs during the move (such as, the expired message will disappear from the server until the destination is restarted.