阻止MassTransit为使用者主机创建RabbitMQ交换

时间:2019-03-21 14:13:07

标签: rabbitmq masstransit

是否可以将MassTransit配置为不为使用者主机创建RabbitMQ交换?我的RabbitMQ用户没有足够的权限在使用队列所在的主机上声明交换,因此MassTransit无法启动并出现以下错误:

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=

这是我使用的代码:

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>(); }); });

0 个答案:

没有答案