Announcement Announcement Module
Collapse
No announcement yet.
Is it possible to set a regex in the queue-names of int-amqp:inbound-channel-adapter? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment


    • #3
      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"/>

      Comment

      Working...
      X