[英]Is there a way to restart the bus using RabbitMq with MassTransit?
I want to restart the bus connection using RabbitMq with MassTransit, the first idea was to stop the connection and start it again but this did not work.我想使用 RabbitMq 和 MassTransit 重新启动总线连接,第一个想法是停止连接并重新启动它,但这没有用。 Is there something more specific or a better way to do that?有没有更具体或更好的方法来做到这一点?
await bus.StopAsync();
await bus.StartAsync(source.Token);
Assuming you are on a current version of MassTransit, you can do exactly that to restart the bus.假设您使用的是当前版本的 MassTransit,您完全可以这样做来重启公交车。
You can see in this unit test that the bus is started and stopped without issue.您可以在此单元测试中看到总线启动和停止没有问题。
await bus.StartAsync(TestCancellationToken);
await bus.StopAsync(TestCancellationToken);
await bus.StartAsync(TestCancellationToken);
await bus.StopAsync(TestCancellationToken);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.