Any way to configure the error queue and control queue endpoint? CloudAMQP configuration...

1,485 views
Skip to first unread message

Jereme Evans

unread,
Oct 18, 2013, 5:58:15 PM10/18/13
to masstrans...@googlegroups.com
I'm trying to use MassTransit with CloudAMQP, so MassTransit cannot create queues on the fly. It looks like it's throwing an error trying to create the control queue. I (think) I am specifying the control queue here:

            Bus.Initialize(sbc => {
                sbc.UseRabbitMq();
                sbc.UseControlBus(cb => cb.ReceiveFrom(new MessageUrn(ConfigurationManager.AppSettings["LoggerControlQueue"])));
                sbc.ReceiveFrom(Settings.LoggerQueue);
                sbc.Subscribe(subs => subs.Handler<LogItem>(logitem => {
                    IPersistentConnectionContext context = GlobalHost.ConnectionManager.GetConnectionContext<LoggerConnection>();
                    context.Connection.Broadcast(logitem);
                }));
            });

But I still end up with a fancy error, inner exception:

"An exception was thrown retrieving the endpoint:amqp://{redacted}@turtle.rmq.cloudamqp.com/thequeue_control"

So, my question is, how can I specify that MassTransit should use specific queues vs trying to create new ones on the fly?

Any tips on setting up MassTransit to work with CloudAMQP?

Thanks!

Jereme

Travis Smith

unread,
Oct 18, 2013, 6:17:42 PM10/18/13
to masstrans...@googlegroups.com
What version of MT are you using? The Uri does not appear to be constructed correctly. You must declare the username and password via the API. We stripe it out of the Uri so it doesn't end up in the logs. Also is the Uri rabbitmq:// protocall?
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/f9586ad5-82f1-4227-b2e1-a74f3750f575%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


--
-Travis

Jereme Evans

unread,
Oct 18, 2013, 6:51:49 PM10/18/13
to masstrans...@googlegroups.com
I'm using version 2.8; the URI looks like:


So you are correct, I did not declare the username and password via the API. I went ahead and specified it as such:

            Bus.Initialize(sbc => {
                sbc.UseRabbitMq(r => r.ConfigureHost(new Uri("rabbitmq://turtle.rmq.cloudamqp.com/cnnibflv"), cfg => {
                    cfg.SetUsername({username});
                    cfg.SetPassword({password});
                }));

                sbc.Subscribe(subs => subs.Handler<LogItem>(logitem => {
                    IPersistentConnectionContext context = GlobalHost.ConnectionManager.GetConnectionContext<LoggerConnection>();
                    context.Connection.Broadcast(logitem);
                }));
            });

And now I'm receiving the following error:

MassTransit.Exceptions.ConfigurationException was unhandled by user code
  HResult=-2146233088
  Message=The service bus was not properly configured:
[Failure] InputAddress The 'InputAddress' is null. #sadpanda I was expecting an address to be set like 'msmq://localhost/queue'or 'rabbitmq://localhost/queue'. The InputAddress is a 'Uri' by the way.
  Source=MassTransit
  StackTrace:
       at MassTransit.Configurators.ConfigurationResultImpl.CompileResults(IEnumerable`1 results) in d:\BuildAgent-03\work\aa063b4295dfc097\src\MassTransit\Configuration\Configurators\ConfigurationResultImpl.cs:line 71
       at MassTransit.ServiceBusFactory.New(Action`1 configure) in d:\BuildAgent-03\work\aa063b4295dfc097\src\MassTransit\Configuration\ServiceBusFactory.cs:line 40
       at MassTransit.Bus.Initialize(Action`1 configure) in d:\BuildAgent-03\work\aa063b4295dfc097\src\MassTransit\Bus.cs:line 59
       at RabbitMQLogger.Web.MvcApplication.Application_Start() in c:\git\labelmaster-library\src\RabbitMQ Logger UI\RabbitMQLogger.Web\Global.asax.cs:line 17
  InnerException: 




On Friday, October 18, 2013 3:17:42 PM UTC-7, Travis Smith wrote:
What version of MT are you using? The Uri does not appear to be constructed correctly. You must declare the username and password via the API. We stripe it out of the Uri so it doesn't end up in the logs. Also is the Uri rabbitmq:// protocall?

On Friday, October 18, 2013, Jereme Evans wrote:
I'm trying to use MassTransit with CloudAMQP, so MassTransit cannot create queues on the fly. It looks like it's throwing an error trying to create the control queue. I (think) I am specifying the control queue here:

            Bus.Initialize(sbc => {
                sbc.UseRabbitMq();
                sbc.UseControlBus(cb => cb.ReceiveFrom(new MessageUrn(ConfigurationManager.AppSettings["LoggerControlQueue"])));
                sbc.ReceiveFrom(Settings.LoggerQueue);
                sbc.Subscribe(subs => subs.Handler<LogItem>(logitem => {
                    IPersistentConnectionContext context = GlobalHost.ConnectionManager.GetConnectionContext<LoggerConnection>();
                    context.Connection.Broadcast(logitem);
                }));
            });

But I still end up with a fancy error, inner exception:

"An exception was thrown retrieving the endpoint:amqp://{redacted}@turtle.rmq.cloudamqp.com/thequeue_control"

So, my question is, how can I specify that MassTransit should use specific queues vs trying to create new ones on the fly?

Any tips on setting up MassTransit to work with CloudAMQP?

Thanks!

Jereme

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstransit-discuss@googlegroups.com.


--
-Travis

Jereme Evans

unread,
Oct 19, 2013, 11:10:23 AM10/19/13
to masstrans...@googlegroups.com
I have it working now. For anyone else looking at using MassTransit 2.8 with CloudAMQP, here is what a basic, working setup looks like:

            Bus.Initialize(sbc => {
                sbc.UseRabbitMq(r => r.ConfigureHost(new Uri(rabbitmq://turtle.rmq.cloudamqp.com/vhostname/queuename), cfg => {
                    cfg.SetUsername(username);
                    cfg.SetPassword(password);
                }));

                sbc.ReceiveFrom("rabbitmq://username:pass...@turtle.rmq.cloudamqp.com/vhostname/queuename");

                sbc.Subscribe(subs => subs.Handler<LogItem>(logitem => {
                    IPersistentConnectionContext context = GlobalHost.ConnectionManager.GetConnectionContext<LoggerConnection>();
                    context.Connection.Broadcast(logitem);
                }));
            });

The things that confused me:

  • You need to specify your queue uri twice. Seems redundant...
  • In the ReceiveFrom(...) uri, you need to include the username and password despite having specified it earlier.
Hope it helps someone!

Chris Patterson

unread,
Oct 19, 2013, 11:01:38 PM10/19/13
to masstrans...@googlegroups.com
It is a bit redundant, but the receiveFrom configures the bus, the configureHost configures the host for ALL queues and exchanges on that host. But you can configure multiple hosts in case you are sending to different virtual hosts and/or rabbitMQ servers.



To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/7ca0aace-cde9-4af2-a552-cd05e140bec9%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages