Results 1 to 3 of 3

Thread: About priority of message

Threaded View

  1. #1
    Join Date
    Nov 2012
    Posts
    18

    Default About priority of message

    Since currently rabbitmq not support the priority of message, i use separate queue for per priority-message. for example, queue.priority.low & queue.priority.high. And every queue has its respective listener, like this:
    Code:
      <rabbit:listener-container connection-factory="connectionFactory" message-converter="jsonMessageConverter"
          error-handler="rabbitErrorHandler" >
        <rabbit:listener queue-names="queue.priority.low" ref="messageConsumer" method="handleLowPriority" />
        <rabbit:listener queue-names="queue.priority.high" ref="messageConsumer" method="handleHighPriority" />
      </rabbit:listener-container>
    My question is:
    1 the instance of listenerContainer is equals to the instance of listener, is that correct? Since in above code i define two listener instance, so the instance of listenerContainer is aslo two.
    2 Since one listener can listening to more that one queue, so i want merge two listener into one:
    Code:
    <rabbit:listener queue-names="queue.priority.low, queue.priority.high" ref="messageConsumer" method="handleMessage" />
    But the question is ,how can i guarantee that queue.priority.high is always consuming before queue.priority.low, queue.priority.low is consumed only when queue.priority.high is empty?


    I noticed that in the class MessageProperties, there are a few properties that may be related to message priority:
    Code:
    public class MessageProperties {
        ...
        private static final Integer DEFAULT_PRIORITY = new Integer(0);
        private volatile Integer priority = DEFAULT_PRIORITY;
        ...
    }
    How can i use them?


    Any reply would be appreciated.
    Regards.
    Last edited by Wuaner; Jan 4th, 2013 at 03:58 AM.

Posting Permissions

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