Subscriber Processing Issues¶
This page describes common issues where subscribers do not consume messages as expected.
Subscriber Does Not Start¶
Subscribers implement:
IAsyncRunnable
and must be started explicitly.
Example:
await subscriber.Start();
Verify:
subscriber.IsRunning
returns:
true
Messages Never Arrive¶
Verify:
- exchange exists;
- queue exists;
- binding exists;
- routing key matches;
- publisher is publishing to the expected exchange.
Use RabbitMQ Management UI to inspect the topology.
Subscriber Is Running But Receives No Messages¶
Verify:
subscriber.IsRunning
and inspect queue statistics.
Possible causes:
- incorrect routing key;
- incorrect exchange;
- queue mismatch;
- publisher using a different topology.
Messages Remain In Queue¶
Possible causes:
- consumer not started;
- consumer disconnected;
- prefetch configuration;
- handler deadlock;
- runtime exception.
Verify:
PrefetchCount
configuration and application logs.
Subscriber Stops Unexpectedly¶
Inspect:
- RabbitMQ logs;
- application logs;
- channel events.
Enable:
EnableChannelEvents = true;
and observe:
OnChannelEventFired
for channel lifecycle events.
Message Handler Throws Exceptions¶
Example:
subscriber.Received.Add(
async (sender, args) =>
{
throw new InvalidOperationException();
});
Verify:
- retry configuration;
- exception handling;
- acknowledgement logic;
- requeue logic.
Incorrect Acknowledgement Behavior¶
Verify the handler sets the expected values.
Success:
args.Acknowledged = true;
Retry:
args.Acknowledged = false;
args.Requeue = true;
No retry:
args.Acknowledged = false;
args.Requeue = false;
Diagnostic Checklist¶
Verify:
- subscriber started;
IsRunning == true;- queue bindings;
- routing keys;
- prefetch count;
- retry configuration;
- channel events;
- application logs.