EasyNetQ icon indicating copy to clipboard operation
EasyNetQ copied to clipboard

我开始接收消息后,会出现中断的情况,请教如何解决?

Open dodu2014 opened this issue 9 months ago • 1 comments

我是这样接收队列消息:

// ** 开始消费
if (!cancellationToken.IsCancellationRequested) {
  await bus.PubSub.SubscribeAsync<IMessageBody>("sub01",
    async message => await messageHandle.HandleMessageAsync(message, cancellationToken),
    cancellationToken: cancellationToken);
  logger.LogInformation("已开启订阅: {time}", DateTimeOffset.Now);
}

我的应用是使用vs中辅助角色服务项目创建的,在其中一个 work 的 StartAsync 方法中启用消费(上述代码)。

应用不定时的会中断,一天可能有7、8次,请问该如何解决?

dodu2014 avatar May 25 '25 04:05 dodu2014

我该如何检测订阅方法是否发生异常呢?

dodu2014 avatar May 26 '25 07:05 dodu2014