Announcement Announcement Module
Collapse
No announcement yet.
Creating Queues, Binding, Exchanges with CacheMode.CONNECTION Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Creating Queues, Binding, Exchanges with CacheMode.CONNECTION

    According the documention:
    When the cache mode is CONNECTION, automatic declaration of queues etc. (See Section 3.15.1, “Automatic Declaration of Exchanges, Queues and Bindings”) is NOT supported.
    So this raises the question of how to handle the creation of queues\etc. when we are using CacheMode.CONNECTION. Looking at the source code we can see that the base RabbitAdmin uses a private method filterDeclarables() before declaring queues\etc and also the private method declareQueues(). Is there a reason these are left private? If an end user wants to use CacheMode.CONNECTION but also wants to have similar behavior to the automatic declaration of queues, what is the best way to accomplish this without using reflection?

  • #2
    The reason auto-declare is disabled when using multiple connections is because it adds a great deal of complexity - for example what to do with exclusive queues - when using a single connection, the consumer and admin use the same connection so there's no problem. When they don't share a connection, how would the admin know which connection to use? It gets even more tricky during recovery.

    All is not lost, you can simply use a RabbitAdmin and invoke queueDeclare() etc yourself.

    Comment


    • #3
      Ok, that makes sense. So is filterDeclarables a call not needed then? What would be a case where an AmqpAdmin shouldn't declare a queue\binding\etc? Thanks!!

      Comment

      Working...
      X