Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: Setting message priority inside message converter

  1. #11
    Join Date
    Feb 2009
    Location
    London
    Posts
    128

    Default

    Yes, the header-mapper thing does not work as commented in the JIRA.

    I thought of subclassing the JmsTemplate and overriding it the doSend as

    Code:
     protected void doSend(MessageProducer producer, Message message) throws JMSException {
          producer.send(message, getDeliveryMode(), message.getJMSPriority(), getTimeToLive());
       }
    But this again is not flexible as it will pass on the JMSPriority.

    Mark,

    I am thinking of your another workaround that you suggested that have two High and Low Jms Adaptor. But how do I corodinate the adaptor listeners so that Low JMS adaptor listener does not start picking messages when there are messages in High-Priority one.

    Thanks

  2. #12
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,844

    Default

    I'm not sure if I understand your question completely, but I would imagine that the important thing is to have 2 different adapters for the outbound side - when *sending* JMS Messages. The inbound side could be a single adapter (or even some other process), since the prioritization happens at the broker.

    Does that make sense? If not, maybe I didn't quite catch the intent of your question.

  3. #13
    Join Date
    Feb 2009
    Location
    London
    Posts
    128

    Default

    Hi Mark, yes you are correct. seems like me not good at pouring my thoughts in english very well.

    Ok, this what I did to stamp JMSPriority on messages. I read the messages from the incoming queue and applied the rules to deetermine the priotity and set that in header and overriden the doSend method JmsTemplate as mentioned above and that worked for me.

    Is there any issue with this approach? I will let all of you know if I end up in problems in my POC.

  4. #14
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,844

    Default

    So, you are saying that you set the JMSPriority and then you are using that to drive the priority at the MessageProducer's send() method, right?

    I believe that is what you are saying, because you are not able to access the Spring Integration Message at that send() call obviously.

    I just want to clarify that first. It gets confusing sometimes with different "Message" instances being discussed in the same scenario

    Thanks,
    Mark

  5. #15
    Join Date
    Feb 2009
    Location
    London
    Posts
    128

    Default

    Yes, that is correct.

    A separate question on poller--

    1) Suppose I configure the poller to have max-messages-per-poll=5 and it runs in default thread( i would assume a single thread). Now suppose, in these 5 messages I have 3 higher priority( A, B, C ) and 2 low( D, E). When poller puts these messages on a channel then how are these messages processed like. I mean will it process like A,B,C, D, E or it will be random. Again Its single threaded. I know it will be different behavior for multi threaded scenario?

  6. #16
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    Since messages will be sorted according to their order they will be retrieved in such order which is A, B, C, D, F. And since you are using single thread, they will be processed in such order.
    They will also be processed in such order in multi-threaded environments or i should say they will be put on the threads in this order, but since processing time of each message might be different the end result might look like out of order.
    I hope that clarifies

  7. #17
    Join Date
    Feb 2009
    Location
    London
    Posts
    128

    Default

    Perfect. That is very helpful, Oleg. Thanks.

    I will post the final thingy when I complete my small POCs and integrate them to a workable thing.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •