Connecting to another machine using RabbitMQ

836 views
Skip to first unread message

Klaus Nji

unread,
Feb 18, 2015, 8:55:29 AM2/18/15
to rabbitm...@googlegroups.com
I have created a sample pub/sub that works on the local machine.  When creating an instance of the ConnectionFactory, I pass it the HostName of "localhost" as illustrated below:

   var factory = new ConnectionFactory() { HostName = "localhost" };

I have installed RabbitMQ on a second machine and have used

 netstat
-ano | find "5672"

to validate that this service has been installed and is indeed listening on port 5672.  However, when I start my publisher, it is unable to connect to the second machine, throwing the following exception:

RabbitMQ.Client.Exceptions.BrokerUnreachableException was unhandled
  HResult=-2146232800
  Message=None of the specified endpoints were reachable
  Source=RabbitMQ.Client
  StackTrace:
       at RabbitMQ.Client.ConnectionFactory.CreateConnection()
       at Producer.PubSubServiceBusEndPoint..ctor(String queueName, String brokerHostName) in c:\dev\src\oss\RabbitMqTutorials\Producer\PubSubServiceBusEndPoint.cs:line 25
       at Producer.Program.Main() in c:\dev\src\oss\RabbitMqTutorials\Producer\Program.cs:line 7
       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: RabbitMQ.Client.Exceptions.ConnectFailureException
       HResult=-2146233087
       Message=Connection failed
       Source=RabbitMQ.Client
       StackTrace:
            at RabbitMQ.Client.Impl.SocketFrameHandler.Connect(TcpClient socket, AmqpTcpEndpoint endpoint, Int32 timeout)
            at RabbitMQ.Client.Impl.SocketFrameHandler..ctor(AmqpTcpEndpoint endpoint, ObtainSocket socketFactory, Int32 timeout)
            at RabbitMQ.Client.Framing.Impl.ProtocolBase.CreateFrameHandler(AmqpTcpEndpoint endpoint, ObtainSocket socketFactory, Int32 timeout)
            at RabbitMQ.Client.ConnectionFactory.CreateFrameHandler()
            at RabbitMQ.Client.ConnectionFactory.CreateConnection()
       InnerException: System.Net.Sockets.SocketException
            HResult=-2147467259
            Message=A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond aaa.bbb.40.176:5672
            Source=System
            ErrorCode=10060
            NativeErrorCode=10060
            StackTrace:
                 at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
                 at System.Net.Sockets.TcpClient.EndConnect(IAsyncResult asyncResult)
                 at RabbitMQ.Client.Impl.SocketFrameHandler.Connect(TcpClient socket, AmqpTcpEndpoint endpoint, Int32 timeout)
            InnerException: 

Is this a firewall issue?

Alvaro Videla

unread,
Feb 18, 2015, 8:59:34 AM2/18/15
to Klaus Nji, rabbitm...@googlegroups.com
See: https://www.rabbitmq.com/access-control.html

Specifically that the guest user can't connect from remote machines

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Simon MacMullen

unread,
Feb 18, 2015, 9:14:51 AM2/18/15
to Alvaro Videla, Klaus Nji, rabbitm...@googlegroups.com
Note that OP's exception said:

"A connection attempt failed because the connected party did not
properly respond after a period of time, or established connection
failed because connected host has failed to respond"

so I think it *is* more likely to be a firewall issue; the
guest/localhost thing should lead to an explicit authentication failure.

OP: I suggest the usual connectivity checks - can you connection using
telnet to port 5672?

Cheers, Simon

On 18/02/15 13:59, Alvaro Videla wrote:
> See: https://www.rabbitmq.com/access-control.html
>
> Specifically that the guest user can't connect from remote machines
>
> On Wed Feb 18 2015 at 2:55:31 PM Klaus Nji <klau...@gmail.com
> <mailto:klau...@gmail.com>> wrote:
>
> I have created a sample pub/sub that works on the local machine.
> When creating an instance of the ConnectionFactory, I pass it the
> HostName of "localhost" as illustrated below:
>
> |
> varfactory =newConnectionFactory(){HostName="localhost"};
> <mailto:rabbitmq-user...@googlegroups.com>.
> To post to this group, send email to rabbitm...@googlegroups.com
> <mailto:rabbitm...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google
> Groups "rabbitmq-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to rabbitmq-user...@googlegroups.com
> <mailto:rabbitmq-user...@googlegroups.com>.
> To post to this group, send email to rabbitm...@googlegroups.com
> <mailto:rabbitm...@googlegroups.com>.
Reply all
Reply to author
Forward
0 new messages