Results 1 to 3 of 3

Thread: Is it possible to set a regex in the queue-names of int-amqp:inbound-channel-adapter?

  1. #1
    Join Date
    Apr 2012
    Posts
    9

    Default Is it possible to set a regex in the queue-names of int-amqp:inbound-channel-adapter?

    I'm doing a component that is going to work with third party components. So I don't know the queue names in advance, i was thinking to set a pattern:

    serviceComponentRequest
    ..............
    twitterComponentRequest
    facebookComponentRequest


    so the declaration would be like this:
    <int-amqp:inbound-channel-adapter
    queue-names=".*ComponentRequest"

    I don't want to have the same queue for all the third party components, is this possible?

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

    Default

    Why not use a Topic Exchange and then have the third party components use routing keys?

    Then, when you bind a Queue to that Exchange you can rely on wildcard patterns.

  3. #3
    Join Date
    Apr 2012
    Posts
    9

    Default

    Thanks! I've done as you said. I paste the configuration here just in case it's useful for someone.
    The consumer:
    <rabbit:queue exclusive="true" name="anonymousQueue" />
    <rabbit:topic-exchange name="testExchange">
    <rabbit:bindings>
    <rabbit:binding queue="anonymousQueue" pattern="test.id.testing"></rabbit:binding>
    </rabbit:bindings>
    </rabbit:topic-exchange>

    <int-amqp:inbound-channel-adapter
    queue-names="#{anonymousQueue.getName()}"
    connection-factory="rabbitConnectionFactory"
    channel="channelFromRabbit" />

    And the publisher:
    <rabbit:topic-exchange name="testExchange">

    </rabbit:topic-exchange>
    <int-amqp:outbound-channel-adapter channel="channelToAmqp" amqp-template="amqpTemplate" exchange-name="testExchange"
    routing-key-expression="test.id.testing"/>

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
  •