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

    Changing delivery policy

    felipeal

      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






        • 1. Re: Changing delivery policy
          clebert.suconic

          Hello Felipe...

          IMO you shouldn't relay on the order of *any* JMS provider.

          If order is relevant for you... I don't know... you probably are doing something wrong in your design. (just IMHO)


          Clebert

          • 2. Re: Changing delivery policy
            felipeal

            Hi Clebert,

            Yes, I agree, this is not a good (neither portable) design, but it's one of the options we are considering for now, mainly for 2 reasons (given our whole context): it might be the easiest to implement and the one with best performance.

            Other options would be to check the domain before the message is sent (so if the throughput to that domain is too high we could return the JMS message to the queue) or to do this kind of sorting before adding the
            message to the queue.

            Anyway, do you think that's possible?

            -- Felipe


            • 3. Re: Changing delivery policy
              felipeal

              BTW, order was not a problem on our initial design, much the opposite, we design the application to achieve high paralelization thorugh JMS and clusteriing. Just later we realized this high performance could cause problems with some SMTP providers :-(

              • 4. Re: Changing delivery policy
                clebert.suconic

                What about using selectors, and having multiple listeners with different selectors... one for each property you need?

                • 5. Re: Changing delivery policy
                  felipeal

                  I thought about selectors too, but I don't think it would work, as the values of the properties are dynamic (i.e., there could be hundreds of different domains)...