我正在使用Rebus将消息发送到Azure Service Bus队列。对于每条消息,我的使用者的处理程序方法似乎被多次调用。 Received.
被写入9个单独的日志文件。
制作人:
await _bus.Advanced.Routing.Send("some-queue", new SomeMessage());
消费者:
public class SomeMessageHandler : IHandleMessages<SomeMessage>
{
public async Task Handle(SomeMessage message)
{
_logger.Information("Received.");
await SomeApiCall();
}
}
消费者配置:
builder.RegisterRebus((configurer, context) => configurer
.Logging(l => l.Serilog())
.Transport(t => t.UseAzureServiceBus("Endpoint=<redcated>;SharedAccessKeyName=<redacted>;SharedAccessKey=<redacted>", "some-queue")));