Joshua, thanks for the Article... I'll read it carefully! =)

Answering to Alan: It is the C++ Broker!

About the code, what I tried to is very simple, I just want parent and child
process reading the same queue...

=========================================================================
def consume_queues(server_queue_name):

        session = connect_to_broker()

        my_pid = str(os.getpid())
        local_queue_name = 'local_' + my_pid + server_queue_name

        queue = session.incoming(local_queue_name)
        session.message_subscribe(queue=server_queue_name,
destination=local_queue_name)
        queue.start()

        dump_queue(session, local_queue)

if __name__ == "__main__":

        queue_name = "queue_for_test"

        try:
                pid = os.fork()
                if pid == 0:
                        # Child start to consume queues
                        consume_queues(queue_name)
                        os._exit(0)
                else:
                        consume_queues(queue_name)
                        child_pid = os.wait()
                        print 'process ' + str(child_pid) + 'has finished'
                        sys.exit(0)
        except OSError, error:
                print 'Unable to fork. Error: %d (%s)' % (error.errno,
error.strerror)
                sys.exit(-1)
=========================================================================

Function *dump_queue* is similar to pubsub topic publisher example.




On Fri, Mar 26, 2010 at 1:18 PM, Joshua Kramer <[email protected]>wrote:

>
>  Is there anyway to do a multiprocess client to consume a queue?
>>>
>>
> Hello Caio,
>
> I wrote a Linux Journal article last year illustrating this exact concept.
> You can find it here:
>
> http://www.linuxjournal.com/magazine/advanced-message-queuing-protocol-amqp
>
> If you'd like a copy of the graphic (they seem to have broken it) let me
> know.
>
> Thanks,
> -Josh
>
> --
>
> -----
> http://www.globalherald.net/jb01
> GlobalHerald.NET, the Smarter Social Network! (tm)
>



-- 
Caio Brentano

Reply via email to