SigGP
SigGP

Reputation: 776

How to connect MassTransit with RabbitMq on CloudAMQP

I have problem to connect MassTransit with RabbitMq on CloudAMQP. Below is my code

var bus = Bus.Factory.CreateUsingRabbitMq(otions => {
    var host = otions.Host(new Uri("rabbitmq://llama-01.rmq.cloudamqp.com"),
    h => { h.Username("my_username"); h.Password("my_password"); });
    otions.ReceiveEndpoint(host, "recvqueue", ep => {
        ep.Handler<Communicate>(Handle);
    });
});

bus.Start();

h.Password and h.Username are correct. While I try to start the bus I get following error:

RabbitMQ Connect Failed: Broker unreachable: [email protected]:5672/

I suspect that the problem is in URI address but I can't find out the correct one.

Upvotes: 2

Views: 1948

Answers (2)

Umut Oku
Umut Oku

Reputation: 21

"Host": "cow-01.rmq2.cloudamqp.com", "Username": "mw****jh", "Password": "Oev7ZC4**cq61ch7u", "VirtualHost": "/mwwjh", "Port": 5672 If the JSON structure is to be used on the host, use this format for cloud

Upvotes: 1

Alexey Zimarev
Alexey Zimarev

Reputation: 19600

Well, I quickly browsed their Getting Started and I can see that your instance gets a vhost that has the same name as your user.

enter image description here

The image above is what I've got after subscribing to a free plan.

For MassTransit, you either need to add the vhost at the end of your connection string, like rabbitmq://llama-01.rmq.cloudamqp.com/my_username, or configure it in the host configuration, along with the username and password.

Upvotes: 3

Related Questions