Announcement Announcement Module
Collapse
No announcement yet.
Receiving Messages based on a Message Selector Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Receiving Messages based on a Message Selector

    Hi

    I am using Spring AMPQ and I would like to do the following.

    I want to implement the request response pattern using the correlation Id with 2 durable queues (request queue and a response queue) bound to one exchange.

    I am using the MessagePostProcessor to set the Correlation Id on the message when sending the message to the exchange along with the reply to address.

    I want to receive the message on the same thread synchronously using the AMPQ template using a message selector (I want to use the correlation Id i setup as the message selector to filter messages). I don't see the message selector option on the AMPQ template. The AMPQ Spec reads that this functionality is available. Is this implemented yet? If yes how do i specify a selector when receiving a message?

    I am specifically interested in knowing how the message selector works and how to configure it. I have a work around for this problem but i would prefer to do it using a message selector.

    Thanks in advance for the help.

    Best Regards,

    Hetti

  • #2
    Hi

    Is this possible with the current release of Spring AMPQ? Would like to know how to go about this.

    Appreciate any response.

    Thanks

    Hetti

    Comment


    • #3
      Which spec were you reading? I found a passing reference to message selectors in 0.9.1, but no indication that they should be implemented by a provider.

      Request-response (or RPC) is a common pattern with AMQP, but it's not efficient to do it with 2 fixed queues (in any messaging system that I know of). The easiest way to implement RPC with AMQP is to use an anonymous queue for the response and a plain direct exchange (even the default exchange). This pattern is implemented in a convenience method in RabbitTemplate.

      Comment


      • #4
        Hi Dave

        Thanks for the reply. I wanted to use 2 durable request and request queues. I don't want to loose the response if my handlers go down for some reason. Can the anonymous queue be setup as a durable queue? I will plan to use the anonymous queues for this purpose.

        Also is there any capability of a message selector? I read this on 0.8 spec. I see this is no longer there on 1.0 spec. It talks about message filters instead.

        Thanks for the reply. If you know anything about message filters please let me know.

        Thanks

        Hetti

        Comment


        • #5
          Anonymous queues are non-durable and exclusive (a bit like temporary queues in JMS). If you a need durable response with the same features you would need to do something different. One option would be to create a queue per consumer using some algorithm to generate the queue name that you know is unique but repeatable (the same algorithm could be used to create the message selector in your original design). Then your consumers know they are unique.

          Comment


          • #6
            Thanks for the response.

            Comment

            Working...
            X