[rabbitmq-discuss] Subscribe to remote rabbitmq queue

Paul Jones pauljones23 at gmail.com
Wed Sep 9 10:11:19 BST 2009


Sridhar,

Rabbit by default should be listening on all addresses on the machine. You
can confirm this by running:
  netstat -an | grep 5672
and validating that an entry such as:
  tcp        0      0 0.0.0.0:5672            0.0.0.0:*               LISTEN

If you're running iptables on your machine, then the command you listed
should *generally* do the trick. However, I wouldn't be able to tell for
sure without seeing the entire output from iptables -L (since you could
always have a deny rule before this one).

Paul.

On Wed, Sep 9, 2009 at 8:54 AM, Sridhar Raman <sridhar.raman at gmail.com>wrote:

> When I run it, this is the error I get:
> */usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/amqp/client.rb:65:in
> `initialize': Could not connect to server hostname:5672 (AMQP::Error)
>     from
> /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/amqp/client.rb:97:in
> `call'
>     from
> /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/amqp/client.rb:97:in
> `unbind'
>     from
> /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:995:in
> `call'
>     from
> /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:995:in
> `run_deferred_callbacks'
>     from
> /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:995:in
> `times'
>     from
> /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:995:in
> `run_deferred_callbacks'
>     from
> /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:in
> `run_machine'
>     from
> /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:in
> `run'
>     from
> /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/amqp.rb:84:in `start'
>     from test_processor.rb:7*
>
> Could it because port 5672 is not accessible from outside?  In that case,
> how do I expose it?
> I tried iptables like this:
> *iptables -A INPUT -p tcp --dport 5672 -j ACCEPT*
>
> But still no luck.  How do I configure rabbitmq to accept requests from
> external IPs?
>
> -S
>
> 2009/9/9 Paul Jones <pauljones23 at gmail.com>
>
> Sridhar,
>>
>> Can you describe how this doesn't work?
>>
>> Paul.
>>
>> On Wed, Sep 9, 2009 at 8:46 AM, Sridhar Raman <sridhar.raman at gmail.com>wrote:
>>
>>> Hi
>>>
>>> This is our current setup that is working in a server:
>>> Listener (that receives the data and publishes it):
>>> *module QueueData
>>>     def receive_data(d)
>>>         $amq.queue("queue_name").publish(d)
>>>     end
>>> end
>>> EM.run {
>>>   $amq = MQ.new
>>>   EM.start_server "0.0.0.0", 22003, QueueData
>>> }*
>>>
>>> Processor (that subscribes to the queue and processes it):
>>> *EM.run {
>>>   amq = MQ.new
>>>   amq.queue("queue_name").subscribe { |d|
>>>     puts d
>>>   }
>>> }*
>>>
>>> How do I subscribe to this queue from another machine?  I tried this:
>>> *AMQP.start(:host => 'hostname', :port => 5672, :logging => true) do
>>>   puts "connected ..."
>>>   mq = MQ.new
>>>   MQ.queue('queue_name').subscribe{ |msg|
>>>     puts msg
>>>   }
>>> end*
>>>
>>> But it doesn't work.  Any suggestions?
>>>
>>> _______________________________________________
>>> rabbitmq-discuss mailing list
>>> rabbitmq-discuss at lists.rabbitmq.com
>>> http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20090909/2972dd62/attachment.htm 


More information about the rabbitmq-discuss mailing list