Difference between ExchangeDeclare ExchangeDeclareNoWait and ExchangeDeclarePassive

383 views
Skip to first unread message

Noel McGrath

unread,
Jul 15, 2019, 4:40:11 AM7/15/19
to rabbitmq-users
Cant find any documentation on why one would use one over the other

Also they all return void so there is no result to look at.

ExchangeDeclareNoWait has the following comment

/// Same as ExchangeDeclare but sets nowait to true and returns void (as there 
/// will be no response from the server).


Looking at the code for public override void _Private_ExchangeDeclare( 


 if (nowait) {
        ModelSend(__req,null,null);
        return;
      }
      RabbitMQ.Client.Impl.MethodBase __repBase = ModelRpc(__req,null,null);
      ExchangeDeclareOk __rep = __repBase as ExchangeDeclareOk;
      if (__rep == null) throw new UnexpectedMethodException(__repBase);


i presume you would use NoWait if not interested in server response?

 

Luke Bakken

unread,
Jul 15, 2019, 8:21:15 PM7/15/19
to rabbitmq-users
Hi Noel,

"Passive" declaration of exchanges and queues are used to check if they exist, but won't create them if missing.

"NoWait" won't wait for a response from RabbitMQ (none will be sent) and no callbacks associated with the response will be called.

The AMQP spec allows you to set NoWait = True and Passive = True but that isn't very useful :-)

Thanks,
Luke

Noel McGrath

unread,
Jul 16, 2019, 3:31:03 AM7/16/19
to rabbitmq-users
Thanks Luke,
So in most cases just use ExchangeDeclare i presume?
Reply all
Reply to author
Forward
0 new messages