4 Replies Latest reply on Apr 1, 2004 1:06 AM by ian

    'dynamic' message-selector  in MDB ?

    ian Newbie

      from the description of message-selector in the EJB spec, it looks like the JMS syntax only allows for static value to be compared. I thought i'd ask to see if JBoss has any extension to allow dynamic comparison ?

      eg. during submission of a message to be consumed by MDB , i'd
      set a long value in the message representing current time

      and in the message-selector , specify a way to compare the submit time
      vs. the pull-out-of the queue time and only pull the message out if
      it exceeds a certain limit ?

        • 1. Re: 'dynamic' message-selector  in MDB ?
          ian Newbie

          sorry for the 3x post..

          • 2. Re: 'dynamic' message-selector  in MDB ?
            Elias Ross Master

            There is a scheduled delivery feature for this.

            llong time = System.currentTimeMills() + sometime;
            Message.setLongProperty("JMS_JBOSS_SCHEDULED_DELIVERY", time);

            • 3. Re: 'dynamic' message-selector  in MDB ?
              ian Newbie

              Is this extension in JBoss 3.2.1 ?

              • 4. Re: 'dynamic' message-selector  in MDB ?
                ian Newbie

                looks like it's only in 3.2.2 . what would it take to back port to 3.2.1 ? Looks like only the 2 files were changed

                module: src/main/org/jboss/mq ; files: SpyMessage.java SpyQueueBrowser.java
                Added the following vendor-specific JMS properties
                public static final String PROPERTY_SCHEDULED_DELIVERY = "JMS_JBOSS_SCHEDULED_DELIVERY";
                public static final String PROPERTY_REDELIVERY_DELAY = "JMS_JBOSS_REDELIVERY_DELAY";
                public static final String PROPERTY_REDELIVERY_COUNT = "JMS_JBOSS_REDELIVERY_COUNT";
                public static final String PROPERTY_REDELIVERY_LIMIT = "JMS_JBOSS_REDELIVERY_LIMIT"; 1. Scheduled delivery, paused (delayed) re-delivery 2. Track number of delivery attempts of a message 3. Set maximum delivery attempts per message 4. Proactively expire messages, without having to restore the whole message from disk if cached. Also, the same timer thread which handles scheduled messages proactively "reaps" expired messages.
                Wrote a custom Timer class which is modeled after java.util.Timer, but won't create a thread until tasks are scheduled. It also has a "clear" method for clearing all scheduled messages.