[rabbitmq-discuss] consumer in background

tyger2007@yahoo.com tyger2007 at yahoo.com
Mon Sep 23 10:53:06 BST 2013


Thanks alvaro like I said this concept is totally new to me , however I would like to know if the consumers would run stand alone , that is apart from the web server ? , if that is the case does it mean I would have to keep my command line open always on my servers?

----- Reply message -----
From: rabbitmq-discuss-request at lists.rabbitmq.com
To: <rabbitmq-discuss at lists.rabbitmq.com>
Subject: rabbitmq-discuss Digest, Vol 76, Issue 24
Date: Mon, Sep 23, 2013 12:00 PM


Send rabbitmq-discuss mailing list submissions to
	rabbitmq-discuss at lists.rabbitmq.com

To subscribe or unsubscribe via the World Wide Web, visit
	https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
or, via email, send a message with subject or body 'help' to
	rabbitmq-discuss-request at lists.rabbitmq.com

You can reach the person managing the list at
	rabbitmq-discuss-owner at lists.rabbitmq.com

When replying, please edit your Subject line so it is more specific
than "Re: Contents of rabbitmq-discuss digest..."


Today's Topics:

   1. Troubleshooting RabbitMQ (Sukhjeet Singh)
   2. federate the unnamed queue? (Greg Roy)
   3. Re: Troubleshooting RabbitMQ (Michael Klishin)
   4. Re: federate the unnamed queue? (Michael Klishin)
   5. Re: federate the unnamed queue? (Alvaro Videla)
   6. Re: Producer consumer in background on a web	server
      (Alvaro Videla)
   7. Re: Federation setup query (Jain, Punit)
   8. Re: Questiong about plugins and clustering (Simon MacMullen)
   9. Re: federate the unnamed queue? (Simon MacMullen)
  10. Re: Troubleshooting RabbitMQ (Simon MacMullen)
  11. Re: Questiong about plugins and clustering (Emile Joubert)
  12. Re: How do the Producer gets response from the subscribers
      (Matthias Radestock)


----------------------------------------------------------------------

Message: 1
Date: Sun, 22 Sep 2013 07:39:55 -0400
From: Sukhjeet Singh <princu.chana at gmail.com>
Subject: [rabbitmq-discuss] Troubleshooting RabbitMQ
To: rabbitmq-discuss at lists.rabbitmq.com
Message-ID:
	<CAB9W+YKEJ6qNX89Cj2SfEO7d85cweod-XYKS=uMGr_VhDmAYBQ at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Sir/Madam,
                 This is for first time I am using RabbitMQ. After
searching, I come to know that first I have to install RabbitMq sever and
after doing that I used a code sample given in rabbitMq's official site.I
am pasting that code here also. I also tried to search the resolution of
this error but I am not able to get it's solution. This is a request to
please help me as soon as it can br possible.

Actually, the problem is that createConnection() method is throwing an
exception and the exception is "BrokerUnreachableException was Unhandled".

Please HELP ASAP.

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130922/734cd42a/attachment.html>

------------------------------

Message: 2
Date: Sun, 22 Sep 2013 10:47:13 -0400
From: Greg Roy <gj.roy75 at gmail.com>
Subject: [rabbitmq-discuss] federate the unnamed queue?
To: rabbitmq-discuss at lists.rabbitmq.com
Message-ID:
	<CAKAqKjuD_5=59Yb4m55UUk+PdeWHu0VRLb8H0-TczarUnA2FWA at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hello All,

I would like to federate all messages to the default unnamed queue - is
this possible?  I have tried variations of pattern matching nothing, but
believe I'll need to alter my publishing behaviour.  True or false?

Thanks in advance,

Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130922/960fa966/attachment-0001.htm>

------------------------------

Message: 3
Date: Sun, 22 Sep 2013 19:31:17 +0100
From: Michael Klishin <michael at rabbitmq.com>
Subject: Re: [rabbitmq-discuss] Troubleshooting RabbitMQ
To: Discussions about RabbitMQ <rabbitmq-discuss at lists.rabbitmq.com>
Message-ID: <BCD3D9F4-D067-4352-B546-9D2F20CDA81E at rabbitmq.com>
Content-Type: text/plain; charset="iso-8859-1"


On sep 22, 2013, at 12:39 p.m., Sukhjeet Singh <princu.chana at gmail.com> wrote:

> Actually, the problem is that createConnection() method is throwing an exception and the exception is "BrokerUnreachableException was Unhandled". 

Sukhjeet,

Can you please be a bit more specific about

 * What the stack trace look like
 * How did you install RabbitMQ
 * If it is running
 * If there's anything in the log
 * What tutorial are you following and for what language

Then it will be much easier to provide specific advice.

MK



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130922/7b2dd9a8/attachment-0001.pgp>

------------------------------

Message: 4
Date: Sun, 22 Sep 2013 19:33:20 +0100
From: Michael Klishin <michael at rabbitmq.com>
Subject: Re: [rabbitmq-discuss] federate the unnamed queue?
To: Discussions about RabbitMQ <rabbitmq-discuss at lists.rabbitmq.com>
Message-ID: <3E151093-B43C-4B67-91B8-B5DC40A66711 at rabbitmq.com>
Content-Type: text/plain; charset="iso-8859-1"

Greg,

On sep 22, 2013, at 3:47 p.m., Greg Roy <gj.roy75 at gmail.com> wrote:

> I would like to federate all messages to the default unnamed queue - is this possible?

It's the default exchange that is "unnamed" (clients specify an empty string to refer to it).
Queue federation will be supposed in the next release (3.2). Are you talking about
exchanges?

>  I have tried variations of pattern matching nothing, but believe I'll need to alter my publishing behaviour.

It should be possible to federate any exchange, as far as I know. Can you post some specific
federation configuration examples and you code, and explain what your queues and bindings
setup is?

MK



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130922/c4af5071/attachment-0001.pgp>

------------------------------

Message: 5
Date: Sun, 22 Sep 2013 14:47:50 -0500
From: Alvaro Videla <videlalvaro at gmail.com>
Subject: Re: [rabbitmq-discuss] federate the unnamed queue?
To: Discussions about RabbitMQ <rabbitmq-discuss at lists.rabbitmq.com>
Message-ID:
	<CAMcAHLXy=RSE9=L=8rr9HS4sGJtZj4eGwDqSOwFpTXLtVq_87A at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi,

If by "unnamed queue" you mean the default exchange with no name, then no,
you can't federate that exchange.

Regards,

Alvaro


On Sun, Sep 22, 2013 at 9:47 AM, Greg Roy <gj.roy75 at gmail.com> wrote:

> Hello All,
>
> I would like to federate all messages to the default unnamed queue - is
> this possible?  I have tried variations of pattern matching nothing, but
> believe I'll need to alter my publishing behaviour.  True or false?
>
> Thanks in advance,
>
> Greg
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://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/20130922/9f82ec8f/attachment-0001.htm>

------------------------------

Message: 6
Date: Sun, 22 Sep 2013 14:59:19 -0500
From: Alvaro Videla <videlalvaro at gmail.com>
Subject: Re: [rabbitmq-discuss] Producer consumer in background on a
	web	server
To: Discussions about RabbitMQ <rabbitmq-discuss at lists.rabbitmq.com>
Message-ID:
	<CAMcAHLVv+65CpZ_eZwLn1b=fd_+dfawHXOB_gWERnkfURu6TXg at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi

On Sun, Sep 22, 2013 at 6:34 AM, tyger2007 at yahoo.com <tyger2007 at yahoo.com>wrote:

> how do I make my php consumers work without running them on a command-line
> to listen to producer messages ?


What do you mean by this? You can just run the PHP consumer directly on the
webserver process, although I wouldn't recommend doing that since you would
end up blocking all the server threads.

Is there a reason why you don't want to run the consumer from the command
line directly?

Regards,

Alvaro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130922/1934f66e/attachment-0001.htm>

------------------------------

Message: 7
Date: Mon, 23 Sep 2013 02:23:27 -0400
From: "Jain, Punit" <Punit.Jain at emc.com>
Subject: Re: [rabbitmq-discuss] Federation setup query
To: Simon MacMullen <simon at rabbitmq.com>
Cc: Discussions about RabbitMQ <rabbitmq-discuss at lists.rabbitmq.com>
Message-ID:
	<DB14E94115BBC84E8960C12C176D06760127ECAD05 at MX25A.corp.emc.com>
Content-Type: text/plain; charset="us-ascii"



> -----Original Message-----
> From: Simon MacMullen [mailto:simon at rabbitmq.com]
> Sent: Friday, September 20, 2013 9:22 PM
> To: Jain, Punit
> Cc: Discussions about RabbitMQ
> Subject: Re: [rabbitmq-discuss] Federation setup query
> 
> On 20/09/2013 1:26PM, Jain, Punit wrote:
> > Hi, We are using federation setup with two URIs defined in an
> > upstream, as suggested by you. I simulated link failure by closing one
> > of the Ethernet port. I observed that it takes around 15-20 minutes to
> > switch link. Why is it taking this much time? Is there a way I can
> > decrease the switch time?
> 
> It should switch as soon as the "old" AMQP connection goes down - so check
> your heartbeat settings.
> 

I think it was set to default value which is 600. I changed it to 30 seconds on upstream.
Now it detects the failure in around a minute and changes the link.


> > One more question: on the same setup, I stopped RabbitMQ server on
> > downstream and started it after few seconds. Sometimes the messages
> > published to upstream exchange during that duration are lost. Though,
> > they were present in the upstream queue during that period, but lost
> > after the downstream broker was started.
> 
> Hmm.
> 
> Of course that shouldn't be happening. How do you know they are lost? In
> particular, it's possible for the downstream bindings to change while a link is
> down, in which case messages can be queued on the upstream, then when the
> link comes back they get transferred over and then dropped.
> Could something like that be happening? The tracer might be helpful to see if
> these messages are indeed getting published downstream.
>


This behavior was observed when both links were up, but we just stopped and started the downstream broker. 
Bindings were not changed, there was only one queue listening to downstream stream with '#' routing key.
I will use tracer when I observe this next time.
 
Thank you, Simon.

> Cheers, Simon
> 
> --
> Simon MacMullen
> RabbitMQ, Pivotal



------------------------------

Message: 8
Date: Mon, 23 Sep 2013 09:41:23 +0100
From: Simon MacMullen <simon at rabbitmq.com>
Subject: Re: [rabbitmq-discuss] Questiong about plugins and clustering
To: Discussions about RabbitMQ <rabbitmq-discuss at lists.rabbitmq.com>
Message-ID: <523FFEB3.9050109 at rabbitmq.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 21/09/2013 02:53, Alvaro Videla wrote:
> Is there a way for a plugin to know when a node joins or leaves the
> cluster?

No, not at the moment. Currently we just ask Mnesia whenever we need to 
know.

> Is there any notification that can be received by my plugin about this
> event happening or I need to poll Mnesia once in a while?

Well, you can invoke rabbit_mnesia:cluster_nodes(running) or 
rabbit_mnesia:cluster_nodes(all) or whatever.

> I see there's rabbit_node_monitor:notify_joined_cluster/0 but that's
> doesn't seem to help me.

No, that's the other way round - used to tell the node monitor that a 
node has joined.

What are you trying to do?

Cheers, Simon



------------------------------

Message: 9
Date: Mon, 23 Sep 2013 10:01:39 +0100
From: Simon MacMullen <simon at rabbitmq.com>
Subject: Re: [rabbitmq-discuss] federate the unnamed queue?
To: Discussions about RabbitMQ <rabbitmq-discuss at lists.rabbitmq.com>
Cc: Greg Roy <gj.roy75 at gmail.com>
Message-ID: <52400373.5080005 at rabbitmq.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 22/09/2013 19:33, Michael Klishin wrote:
> It should be possible to federate any exchange, as far as I know.

As Alvaro pointed out, it's any exchange other than the default exchange 
(since the "default exchange" really just means "publish to queue").

I'll update the documentation to make this clearer.

Cheers, Simon



------------------------------

Message: 10
Date: Mon, 23 Sep 2013 10:04:51 +0100
From: Simon MacMullen <simon at rabbitmq.com>
Subject: Re: [rabbitmq-discuss] Troubleshooting RabbitMQ
To: Discussions about RabbitMQ <rabbitmq-discuss at lists.rabbitmq.com>
Cc: Sukhjeet Singh <princu.chana at gmail.com>
Message-ID: <52400433.1060904 at rabbitmq.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 22/09/2013 12:39, Sukhjeet Singh wrote:
> Actually, the problem is that createConnection() method is throwing an
> exception and the exception is "BrokerUnreachableException was Unhandled".

The clue's in the name. The broker was not reachable. Catch the 
exception to find out more, but I would bet that you haven't pointed the 
ConnectionFactory at the broker.

Cheers, Simon


------------------------------

Message: 11
Date: Mon, 23 Sep 2013 10:06:36 +0100
From: Emile Joubert <emile at rabbitmq.com>
Subject: Re: [rabbitmq-discuss] Questiong about plugins and clustering
To: Discussions about RabbitMQ <rabbitmq-discuss at lists.rabbitmq.com>
Message-ID: <5240049C.4060204 at rabbitmq.com>
Content-Type: text/plain; charset=ISO-8859-1



Hi Alvaro,

On 21/09/13 02:53, Alvaro Videla wrote:

> Is there a way for a plugin to know when a node joins or leaves the
> cluster? 

A plugin could subscribe to Mnesia system events that will report when
Mnesia stops and starts on nodes:
 http://www.erlang.org/doc/apps/mnesia/Mnesia_chap5.html#id76679

Depending on the kind of plugin you are writing you could use the
information sent to the log exchange (amq.rabbitmq.log) to determine
when nodes leave and join.



-Emile





------------------------------

Message: 12
Date: Mon, 23 Sep 2013 10:16:53 +0100
From: Matthias Radestock <matthias at rabbitmq.com>
Subject: Re: [rabbitmq-discuss] How do the Producer gets response from
	the subscribers
To: Discussions about RabbitMQ <rabbitmq-discuss at lists.rabbitmq.com>
Cc: ramkkk <mramu789 at gmail.com>
Message-ID: <52400705.3000600 at rabbitmq.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 19/09/13 13:15, ramkkk wrote:
> Producer the sends a command to the consumer  to spawn the process . so each
> consumer has to give the response back to the Producer ..
>
>   but i am not getting the response back to the Producer, consumer is going
> on the infinite loop...
> [...]
> consumer code
> [...]
>      def on_request(self,ch, method, props, body):
>          self.spawn_processes(2)
>          self.response = [process.pid for process in self.spawned_processes]
>          ch.basic_publish(exchange='logs',
>                       routing_key='',
>                       properties=pika.BasicProperties(correlation_id = \
>                                                       props.correlation_id,
>                                                       delivery_mode=2 ,
>                                                       ),
>
>                       body=str(self.response))
>          ch.basic_ack(delivery_tag = method.delivery_tag)

The consumer is publishing the response to the 'logs' exchange with a '' 
routing key, whereas...

> Producer
> [...]
>      def __init__(self):
>          self.connection = pika.BlockingConnection(pika.ConnectionParameters(
>                  host='localhost'))
>          self.channel = self.connection.channel()
>          self.channel.exchange_declare(exchange='logs',
>                           type='fanout')
>          result = self.channel.queue_declare(exclusive=True)
>          self.callback_queue = result.method.queue
>
>          self.channel.basic_qos(prefetch_count=1)
>          self.channel.basic_consume(self.on_response, no_ack=True,
>                                     queue=self.callback_queue)

...the producer is expecting replies on an exclusive, server-named queue.

Clearly that isn't going to work. And because the 'logs' exchange is 
also the exchange on which the consumer queue is bound you end up with 
the 'infinite loop' at the consumer since the response published by the 
consumer will be consumed by the consumer!

You need to change your consumer to publish the response to the default 
exchange ('') with the routing_key taken from props.reply_to of the request.

Matthias.


------------------------------

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss


End of rabbitmq-discuss Digest, Vol 76, Issue 24
************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130923/16da1935/attachment.htm>


More information about the rabbitmq-discuss mailing list