Announcement Announcement Module
Collapse
No announcement yet.
How to determine if an exchange exists? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to determine if an exchange exists?

    What's the best way to determine if an exchange exists already on the broker?

    There seems to be a exchangeDeclarePassive method on the Channel interface but I don't see it available via the RabbitAdmin implementation where the other related exchange methods are.

    I'd like to do something like on start up:

    if (exchangeExists)
    do nothing
    else
    createExchange

    My reason for doing this is that I want to recreate an exchange (if it doesn't already exist) after failover remediation which may include restarting the broker.

  • #2
    The declareExchange() method is idempotent actually. So, it should do what you've described out-of-the-box.

    Comment

    Working...
    X