I've got a quick beginner question.
I've got a consumer. When it's done working it checks to see if anything
else is waiting in the private queue that it's using. If there is
nothing waiting, it just wants to listen (with a callback or similar)
rather than spin in a loop burning cycles.
It wants any messages received after it's last inquiry to trigger the
callback (to avoid a race where it checks, a message then arrives, then
it starts listening, but leaves that message orphaned). The trick though
is that there is only 1 consumer, and if it's processing a message, it'd
prefer not to receive a callback for new ones until it is again "IDLE".
What's the classic way to handle this? Is this built in, or do a I need
to set the callback to something that manages my consumer and keeps
track of consumer state.
- August