5 Replies Latest reply on Nov 29, 2006 7:57 PM by Felipe Leme

    Changing delivery policy

    Felipe Leme Newbie

      Hi all,

      First of all, sorry if this is not the right forum for posting this message - if it's not, I will repost it in the proper question.

      Now, back to my question, I have the following scenario:

      1.JMS Messages representing an email message are posted to a JMS queue
      2.MDBs consume these (JMS) messages, sending the email to the proper destination

      So far so good, but sometimes I some emails are rejected because I'm sending too many messages to a given domain. So, one cool solution for this problem was to customize the JMS provider in order to do some sort of round-robin when selecting what's the next message to be consumed (instead of the traditional 'first come, first served' approach). In this particular case, the process that create the JMS messages would add a JMS property with the SMTP domain the message belongs to, and the JMS provider would then use that property to determine which message to send next.

      For instance, let's say I have 5 messages, inserted in the following order:

      1 - domain X
      2 - domain X
      3 - domain Y
      4 - domain Y
      5 - domain Z

      Tradicionally, these message would be consumed in the same order. But what I want is to change the order to:

      1 - domain X
      3 - domain Y
      5 - domain Z
      2 - domain X
      4 - domain Y

      So, my question is: is it possible to change how JBoss decides what's the next message to be delivered? If so, how do I do it? Changing some sort of invoker?

      TIA for any help,

      -- Felipe