Prevent MassTransit from creating a RabbitMQ exchange for a consumer host

我的未来我决定 提交于 2019-12-13 03:49:53

问题


Is it possible to configure MassTransit to not create a RabbitMQ exchange for a consumer host? My RabbitMQ user has not enough rights to declare an exchange at the host where the consuming queue is located, so MassTransit fails to start with the following error:

Unhandled Exception: MassTransit.RabbitMqTransport.RabbitMqConnectionException: Operation interrupted ---> RabbitMQ.Client.Exceptions.OperationInterruptedExcept ion: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, c ode=403, text="ACCESS_REFUSED - access to exchange '***' i n vhost '***' refused for user '***'", classId= 40, methodId=10, cause=

Here is the code that I use:

var bus = Bus.Factory.CreateUsingRabbitMq(sbc => { var host = sbc.Host(host: "***", port: 5671, virtualHost: "***", configure: configurator => { configurator.UseSsl(sslConfigurator => { sslConfigurator.Certificate = certificate; sslConfigurator.UseCertificateAsAuthenticationIdentity = true; sslConfigurator.ServerName = "***"; }); }); sbc.ReceiveEndpoint(host, "***", endpointConfigurator => { endpointConfigurator.Consumer<UpdateCustomerConsumer>(); }); });

来源:https://stackoverflow.com/questions/55282409/prevent-masstransit-from-creating-a-rabbitmq-exchange-for-a-consumer-host

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!