Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EasyNetQ fails to publish to RabbitMQ - PersistentChannel timed out

I am trying to connect to RabbitMQ with EasyNetQ. RabbitMQ is on remote VM.

_rabbitBus = RabbitHutch.CreateBus(
    string.Format("host={0};virtualhost={1}", 
    _hostSettings.Host, _hostSettings.VHost),
     x => x.Register<IEasyNetQLogger>(l => _logger));

_rabbitBus.Subscribe<Message>(_topic, ReceiveMessage, m => m.WithTopic(_topic));

I get a TimeoutException The operation requested on PersistentChannel timed out.. Remote VM is replying to pings, ports 5672 and 15672 are opened (checked with nmap). RabbitMQ management can be accessed from my host.

Also, if RabbitMQ is run on my local machine, it works fine. I've tried connecting to RabbitMQ installed on my computer from other pc's in LAN, and it also works.

I've come to an assumption, that it's related to the fact it's on a virtual machine, and maybe there's something wrong in connection. But again, Rabbit's web management works fine.

Also tested on EasyNetQ Test application - works on localhost, but not on remote.

Output as following:

DEBUG: Trying to connect
ERROR: Failed to connect to Broker: '192.168.0.13', Port: 5672 VHost: '/'. 
       ExceptionMessage: 'None of the specified endpoints were reachable'
ERROR: Failed to connected to any Broker. Retrying in 5000 ms
  • EasyNetQ v0.28.4.242
like image 759
wojciech_rak Avatar asked Apr 05 '14 14:04

wojciech_rak


1 Answers

As Mike suggested i had this and then checked the permissions. "guest" user can only connect via localhost (see RabbitMQ Access Control.) Try adding a user with permissions using the management interface and then connect as below

var _bus = RabbitHutch.CreateBus(string.Format("host={0};virtualhost={1};username={2};password={3}", 
_hostSettings.Host, _hostSettings.VHost, _hostSettings.UserName, _hostSettings.Password));
like image 158
Mark Avatar answered Sep 18 '22 09:09

Mark