In AMQP 0-10, declare and consume are two distinct operations. When creating a receiver through qpid::messaging, we first declare then consume from the queue.
For a timed auto-delete queue, the delayed auto-delete can tae place between the declare and the consume, resulting in a session error. It would be nice to avoid this. The workaround of course is to set the delay for auto-delete to be sufficiently large that the client will either have reconnected or is likely not reconnecting.
However a simple solution would be to reset the timer on the declare, allowing time for the consume.
This does not prevent the race between a non-timed auto-delete triggered by one session and declare/consume from a different client connection.