Results 1 to 2 of 2

Thread: How to determine if an exchange exists?

  1. #1

    Default 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. #2
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •