Announcement Announcement Module
Collapse
No announcement yet.
High Priority Messages Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • High Priority Messages

    Hello again,

    Quick question: does Spring AMQP support the notion of message priority? The AMQP spec says that an implementation *may* provide such support. By this notion I understand that a (relatively) high priority message would move from the exchange to the head (or close to the head) of the appropriate message queues. Perhaps this is really a RabbitMQ question...

    Also, when I view what I think is the current documentation for the Spring AMQP classes (see below for lengthy URL), I find hyperlinks to a Message class. But clicking on this link gives a 404. Is there no such class, is this a broken link, or am I looking at the wrong docs?

    Thanks for your help.

    -Paul

    http://www.jarvana.com/jarvana/view/...s-noframe.html

  • #2
    First, we don't by default map the SI header MessageHeaders.PRIORITY (priority) to the AMQP priority header. However, even when configuring the adapter to do so...

    Code:
        <int-amqp:outbound-channel-adapter channel="toRabbit"
    		amqp-template="amqpTemplate" exchange-name="si.test.exchange" 
                    mapped-request-headers="priority"
    		routing-key="si.test.binding"/>
    ...my experimentation does not indicate it is used by Rabbit. Messages sent to the queue arrive serially, regardless of the priority header.

    Therefore, I don't believe Rabbit supports priority but, since a listener can bind to multiple queues, you can come close by sending low-volume high priority messages to a different queue.

    Code:
        <int:channel id="toRabbit" />
    
        <int-amqp:outbound-channel-adapter channel="toRabbit"
    		amqp-template="amqpTemplate" exchange-name="si.test.exchange"
    		routing-key="si.test.binding"/>
    
        <int:channel id="toRabbitHigh" />
    
        <int-amqp:outbound-channel-adapter channel="toRabbitHigh"
    		amqp-template="amqpTemplate" exchange-name="si.test.exchange" 
    		routing-key="si.test.binding2"/>
    And on the receiving side...

    Code:
        <int-amqp:inbound-channel-adapter channel="fromRabbit" mapped-request-headers="priority"
                                          queue-names="si.test.queue, si.test.queue2"
                                          connection-factory="connectionFactory" />
    This worked fine for me; messages sent to the second queue jump ahead of any messages still in the first queue.

    Re: JavaDoc; use our official docs - http://static.springsource.org/sprin...1.0.x/apidocs/

    Linked from here http://www.springsource.org/spring-amqp

    It looks like the problem is that provider you are using is just showing the spring-rabbit javadocs (from the jar), with no links to the spring-amqp jar.

    Comment


    • #3
      Beautiful, Gary - thank you very much.

      I had already considered the user of a second queue, but wanted to see if this could be avoided.

      -Paul

      Comment

      Working...
      X