Hi,
I implemented the following using MassTransit 2.9.9, publishing messages to a remote RabbitMQ exchange, which binds to a queue, that appears to be working well.
The message are sent and routed to the queue that is bound to the exchange, and the messages are consumed by a broker.
// Code for MassTransit 2.9.9 with RabbitMQ.Client 3.4.3
var uri = new Uri("rabbitmq://<remote_host>/<exchange>");
var bus = ServiceBusFactory.New((config) =>
{
config.UseRabbitMq(r =>
{
r.ConfigureHost(uri, h =>
{
h.SetUsername("user");
h.SetPassword("passwd");
});
});
config.ReceiveFrom("rabbitmq://<remote_host>/<some_queue>"); // Not using this queue, as this program only publish, doesn't consume
});
var message = new MyMessage { Text = "Hi" };
bus.Publish(message);
Now when I try to convert it to MassTransit 3.0.5-alpha, I'm getting the following error in the RabbitMQ log on the remote host:
=INFO REPORT==== 26-May-2015::18:15:48 ===
accepting AMQP connection <0.6465.2> (<remote_host>:64881 -> <remote_host>:5672)
=ERROR REPORT==== 26-May-2015::18:15:58 ===
closing AMQP connection <0.6465.2> (<remote_host>:64881 -> <remote_host>:5672):
{handshake_timeout,frame_header}
Here's the code:
// MassTransit 3.0.5 with RabbitMQ.Client 3.5.2
const string host = "rabbitmq://<remote_host>/"; // using default virtual host at /
_hostAddress = new Uri(host);
_queueAddress = new Uri(host + "<exchange>");
_bus = Bus.Factory.CreateUsingRabbitMq (x =>
{
x.Host(_hostAddress, h =>
{
h.SetUsername("user");
h.SetPassword("passwd");
});
});
_busHandle = _bus.Start();
var message = new MyMessage { Text = "Hi" };
// It times out somewhere after this:
ISendEndpoint endpoint = await _bus.GetSendEndpoint(_queueAddress);
await endpoint.Send(message);
I looked at the code examples available online, and couldn't figure out why it doesn't work.
Any ideas?
Thanks,
Annie