Upgraded to 2.7.1 Now cannot publish to Rabbit Virtual Host

1,485 views
Skip to first unread message

Binary Worrier

unread,
Feb 12, 2013, 6:14:04 AM2/12/13
to masstrans...@googlegroups.com
Hi, we tried upgrading to MT 2.71, but unfortunately cannot publish to Rabbit Virtual Host (we can publish to the default host perfectly well), I've treid upgrading Rabbit MQ to version 3.0.2 with no effect).
Any help would be greatly appreciated, thanks.

This code gives the following exception

public interface INoddyMessage
    : CorrelatedBy<Guid>
{
    string Name { get; }
}

public class NoddyMessage
    : INoddyMessage
{
    public Guid CorrelationId { get; set; }
    public string Name { get; set; }
}

static void Main(string[] args)
{
    Bus.Initialize(b =>
    {
        b.UseRabbitMq();
        b.ReceiveFrom("rabbitmq://UserName:Password@localhost/MyVirtualHost/NoddyMTEndPoint");
        b.Subscribe(h =>
        {
            h.Handler<INoddyMessage>(msg =>
            {
                Console.WriteLine("New Message {0} - {1}", msg.CorrelationId, msg.Name);
            });
        });
    });

    Bus.Instance.Publish(new NoddyMessage { CorrelationId = Guid.NewGuid(), Name = "Mark", Published = DateTime.Now });

    Console.WriteLine("Press enter to terminate"); Console.ReadLine();
    Bus.Shutdown();
}

Throws . . .
MassTransit.Exceptions.PublishException was unhandled
  HResult=-2146233088
  Message=At least one exception occurred publishing ConsoleApplication1.NoddyMessage to rabbitmq://localhost/Optimus/ConsoleApplication1:NoddyMessage
  Source=MassTransit
  StackTrace:
       at MassTransit.ServiceBus.Publish[T](T message, Action`1 contextCallback) in d:\BuildAgent-02\work\19b3d91f8acfae7a\src\MassTransit\ServiceBus.cs:line 205
       at MassTransit.ServiceBus.Publish[T](T message) in d:\BuildAgent-02\work\19b3d91f8acfae7a\src\MassTransit\ServiceBus.cs:line 154
       at ConsoleApplication1.Program.Main(String[] args) in c:\Users\MLysaght\Documents\Visual Studio 11\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs:line 30
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: MassTransit.Exceptions.SendException
       HResult=-2146233088
       Message=rabbitmq://localhost/Optimus/ConsoleApplication1:NoddyMessage => An exception was thrown during Send
       Source=MassTransit
       StackTrace:
            at MassTransit.Transports.Endpoint.Send[T](ISendContext`1 context) in d:\BuildAgent-02\work\19b3d91f8acfae7a\src\MassTransit\Transports\Endpoint.cs:line 109
            at MassTransit.Pipeline.Sinks.EndpointMessageSink`1.<Enumerate>b__0(IBusPublishContext`1 x) in d:\BuildAgent-02\work\19b3d91f8acfae7a\src\MassTransit\Pipeline\Sinks\EndpointMessageSink.cs:line 45
            at MassTransit.Pipeline.Sinks.OutboundConvertMessageSink`1.<>c__DisplayClass2.<>c__DisplayClass4.<Enumerate>b__1(ISendContext x) in d:\BuildAgent-02\work\19b3d91f8acfae7a\src\MassTransit\Pipeline\Sinks\OutboundConvertMessageSink.cs:line 36
            at MassTransit.ServiceBus.Publish[T](T message, Action`1 contextCallback) in d:\BuildAgent-02\work\19b3d91f8acfae7a\src\MassTransit\ServiceBus.cs:line 178
       InnerException: RabbitMQ.Client.Exceptions.BrokerUnreachableException
            HResult=-2146232800
            Message=None of the specified endpoints were reachable
            Source=RabbitMQ.Client
            StackTrace:
                 at RabbitMQ.Client.ConnectionFactory.CreateConnection(Int32 maxRedirects)
                 at RabbitMQ.Client.ConnectionFactory.CreateConnection()
                 at MassTransit.Transports.RabbitMq.RabbitMqConnection.Connect() in d:\BuildAgent-02\work\19b3d91f8acfae7a\src\Transports\MassTransit.Transports.RabbitMq\RabbitMqConnection.cs:line 48
                 at MassTransit.Transports.ConnectionHandlerImpl`1.Connect() in d:\BuildAgent-02\work\19b3d91f8acfae7a\src\MassTransit\Transports\ConnectionHandlerImpl.cs:line 48
                 at MassTransit.Transports.ConnectOnFirstUsePolicy.Execute(Action callback) in d:\BuildAgent-02\work\19b3d91f8acfae7a\src\MassTransit\Transports\ConnectOnFirstUsePolicy.cs:line 31
                 at MassTransit.Transports.ConnectionPolicyChainImpl.Next(Action callback) in d:\BuildAgent-02\work\19b3d91f8acfae7a\src\MassTransit\Transports\ConnectionPolicyChainImpl.cs:line 49
                 at MassTransit.Transports.ConnectionPolicyChainImpl.Execute(Action callback) in d:\BuildAgent-02\work\19b3d91f8acfae7a\src\MassTransit\Transports\ConnectionPolicyChainImpl.cs:line 54
                 at MassTransit.Transports.ConnectionHandlerImpl`1.Use(Action`1 callback) in d:\BuildAgent-02\work\19b3d91f8acfae7a\src\MassTransit\Transports\ConnectionHandlerImpl.cs:line 87
                 at MassTransit.Transports.RabbitMq.OutboundRabbitMqTransport.Send(ISendContext context) in d:\BuildAgent-02\work\19b3d91f8acfae7a\src\Transports\MassTransit.Transports.RabbitMq\OutboundRabbitMqTransport.cs:line 48
                 at MassTransit.Transports.Transport.Send(ISendContext context) in d:\BuildAgent-02\work\19b3d91f8acfae7a\src\MassTransit\Transports\Transport.cs:line 51
                 at MassTransit.Transports.Endpoint.Send[T](ISendContext`1 context) in d:\BuildAgent-02\work\19b3d91f8acfae7a\src\MassTransit\Transports\Endpoint.cs:line 103
            InnerException: RabbitMQ.Client.Exceptions.OperationInterruptedException
                 HResult=-2146233088
                 Message=The AMQP operation was interrupted: AMQP close-reason, initiated by Library, code=541, text="Unexpected Exception", classId=0, methodId=0, cause=System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at RabbitMQ.Client.Impl.Frame.ReadFrom(NetworkBinaryReader reader)
   at RabbitMQ.Client.Impl.SocketFrameHandler_0_9.ReadFrame()
   at RabbitMQ.Client.Impl.ConnectionBase.MainLoopIteration()
   at RabbitMQ.Client.Impl.ConnectionBase.MainLoop()
                 Source=RabbitMQ.Client
                 StackTrace:
                      at RabbitMQ.Client.Impl.SimpleBlockingRpcContinuation.GetReply()
                      at RabbitMQ.Client.Impl.ModelBase.ConnectionOpen(String virtualHost, String capabilities, Boolean insist)
                      at RabbitMQ.Client.Framing.Impl.v0_9_1.Connection.Open(Boolean insist)
                      at RabbitMQ.Client.Impl.ConnectionBase..ctor(ConnectionFactory factory, Boolean insist, IFrameHandler frameHandler)
                      at RabbitMQ.Client.Framing.Impl.v0_9_1.Connection..ctor(ConnectionFactory factory, Boolean insist, IFrameHandler frameHandler)
                      at RabbitMQ.Client.Framing.Impl.v0_9_1.ProtocolBase.CreateConnection(ConnectionFactory factory, Boolean insist, IFrameHandler frameHandler)
                      at RabbitMQ.Client.ConnectionFactory.FollowRedirectChain(Int32 maxRedirects, IDictionary connectionAttempts, IDictionary connectionErrors, AmqpTcpEndpoint[]& mostRecentKnownHosts, AmqpTcpEndpoint endpoint)
                 InnerException: 


Chris Patterson

unread,
Feb 12, 2013, 11:37:15 AM2/12/13
to masstrans...@googlegroups.com
Did you send a MakeWayForNoddy message to start it up?

Joking - seriously, if it can't reach the broker the URI is wrong and it's not connecting to RabbitMQ. Make sure you have all the right ports and stuff configured.


--
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/msg/masstransit-discuss/-/xTYH6vHhr8gJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Mark Lysaght

unread,
Feb 12, 2013, 11:55:00 AM2/12/13
to masstrans...@googlegroups.com

Chris, using exactly same endpoints (vhost name, user name & password etc) as we did yesterday with v2.6.3. The only difference is the MassTransit NuGet packages.

Chris Patterson

unread,
Feb 12, 2013, 6:15:55 PM2/12/13
to masstrans...@googlegroups.com
Well, for security reasons, the username/password are now taken out of the message URI before adding them to the message headers.

So you may need to use the UseRabbitMq(x => x.ConfigureHost("rabbitmq://yourhost/yourvhost/yourqueue", x=> x.UserName, x.Password)).

That's how the host username/password are specified.
Message has been deleted
Message has been deleted
Message has been deleted

Khalid Abuhakmeh

unread,
Feb 20, 2013, 11:03:28 AM2/20/13
to masstrans...@googlegroups.com
Hello David,

what does your queueUri look like? Does it include the username and password, or does it just point to the host and the vhost?
Also I noticed your code says "queueName" is that only the queue name and not the traditional "rabbitmq://" uri?

I am also trying to get CloudAQMP working, but I can't get the above to work.

Any help would be appreciated. Thank you.

On Wednesday, February 20, 2013 9:38:52 AM UTC-5, David Rettberg wrote:
We also tried to implement Chris' suggested fix, resulting in the following code to setup our bus:
_bus = ServiceBusFactory.New(sbc =>
{
sbc.UseRabbitMq(x => x.ConfigureHost(new Uri(queueUri),
y => { y.SetUsername(qUserName);
y.SetPassword(qPwd); }));
sbc.UseRabbitMqRouting();
sbc.UseControlBus();
sbc.ReceiveFrom(queueName);
sbc.SetConcurrentConsumerLimit(1);
sbc.Subscribe(x => { subscriptions removed for brevity });
});
Unfortunately, we still got the "connection was forcibly closed" error message. We then tried removing the call to UseRabbitMqRouting(), and our publishes started working.
To add further confusion, the first line on the RabbitMQ Configuration Options page if the MT documentation states that UseRabbitMqRouting() is "the recommended approach for configuring MassTransit for use with RabbitMQ." However, when I hover over the call in Visual Studio 2012, the Intellisense popup starts with "[deprecated]."
(I apologize if this posts twice, but my first attempted post didn't show up)

On Tuesday, February 19, 2013 3:37:07 PM UTC-6, Justin Rusbatch wrote:
I'm experiencing this issue when attempting to connect to CloudAMQP using v2.7.1 of MassTransit and MassTransit.RabbitMQ (v3.0.2 of RabbitMQ.Client). Specifying the credentials in the call to 'ConfigureHost' by calling SetUsername and SetPassword did not have an effect.
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 masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/masstransit-discuss/-/xTYH6vHhr8gJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
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 masstrans...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
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.

David Rettberg

unread,
Feb 20, 2013, 12:04:36 PM2/20/13
to masstrans...@googlegroups.com
queueName has the format "rabbitmq://username:password@servername/vhost/queueName"
 
I couldn't find any documentation on the ConfigureHost() parameters, so right now we are using, as our best guess, a queueUri withthe format "rabbitmq://servername/vhost/queueName".  We did try it the full queueName including username and password, but publishes still failed.

Khalid Abuhakmeh

unread,
Feb 20, 2013, 12:47:19 PM2/20/13
to masstrans...@googlegroups.com
thanks, I'll give that a try and report back the results.

Khalid Abuhakmeh

unread,
Feb 20, 2013, 12:57:11 PM2/20/13
to masstrans...@googlegroups.com
Hey it works! Awesome. Thank you so much. Such a weird combination.

Chris Patterson

unread,
Feb 22, 2013, 12:59:10 PM2/22/13
to masstrans...@googlegroups.com
Yes, UseRabbitMqRouting() is deprecated (it should be marked with Obsolete, giving you a warning at compile time). Using it essentially replaces any configuration in UseRabbitMq() with an empty RabbitMQ configuration.


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.
Reply all
Reply to author
Forward
0 new messages