> I think "if not consumer.is_declared(self)" is TRUE only after
> "self._set_current_channel(channel)" has been called;
> so I think declare consumers after "self._set_current_channel(channel)" below is a good idea.
We already do consumer re-declaration in cases of a connection failing in the error callback:
for consumer in self._consumers: consumer.declare(self)
But the problem that this error callback (on_reconnection) may fail due timeouts,
another connection losing, etc. It also may failed in _set_current_channel(channel) if we move the declaration code there, no difference.
So, in order to 100% make sure that we declared all queues/bindings/exchanges before staring consuming I kept the channel in consumer.declare:
> I think "if not consumer. is_declared( self)" is TRUE only after set_current_ channel( channel) " has been called; set_current_ channel( channel) " below is a good idea.
> "self._
> so I think declare consumers after "self._
We already do consumer re-declaration in cases of a connection failing in the error callback:
def on_reconnection (new_channel) : set_transport_ socket_ timeout( ) _set_current_ channel( new_channel)
self.
self.
for consumer in self._consumers:
consumer. declare( self)
But the problem that this error callback (on_reconnection) may fail due timeouts, channel( channel) if we move the declaration code there, no difference.
another connection losing, etc. It also may failed in _set_current_
So, in order to 100% make sure that we declared all queues/ bindings/ exchanges before staring consuming I kept the channel in consumer.declare:
def declare(self, conn):
self. queue.declare( )
...
...
And then in connection. consume( ) I check this point via is_declared()