Closed afmuller closed 6 years ago
Hi @afmuller - RawRabbit handles connection failure and reconnection etc out of the box. The internal logger will create entires as the events happens. If this isn't enough, you can get hold of the underlying consumer; the task return from SubscribeAsync
is in fact a Task<IPipeContext>
, the execution context from the operation. There is no easy way to get hold of the context, but this should work
var t = subscriber.SubscribeAsync<Message>(async msg => {...});
if (t is Task<IPipeContext> contextTask)
{
await contextTask;
var consumer = contextTask.Result.GetConsumer();
consumer.ConsumerCancelled += (sender, args) => { };
consumer.Model.ModelShutdown += (sender, args) => { };
}
Note that the context exposes internal state that if changed might have undocumented affect on RawRabbit.
HTH!
I have a basic consumer:
How can a detect failure of the consumer? E.g. rabbitmq server goes down, network is down etc. How do I know if the consumer is still running or not? I thought I could monitor the task (i.e in this case entitySubscriptionTask) but to completion immediately.
Is there an event I can subscribe to that can notify me if there is a problem or an error with the subscription?
Andrew