I've got a federation consisting of two 2-node clusters, with federation
going in both directions.


I took the worker tutorial
( http://www.rabbitmq.com/tutorials/tutorial-two-python.html ) example and
modified it to talk on a specific exchange, and the exchange type is
'direct'.


When I send a message to my federated exchange, two workers (one in each
cluster) gets the message.


What do I need to do in order to have only one worker get the message,
instead of one per federation?


I thought that the acknowledgement


     ch.basic_ack(delivery_tag = method.delivery_tag)




would go across the federation, but I seem to have done something wrong,
either in configuration or code, and I have no idea which.


Thanks for help shedding light on the error of my ways!


In case full code is useful:


My complete new_task.py: http://pastebin.com/8WEhTTwV
My worker.py: http://pastebin.com/JbcsqSfm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130605/e8c99648/attachment.htm>

Search Discussions

  • Simon MacMullen at Jun 6, 2013 at 10:19 am

    On 05/06/13 21:03, Pete Emerson wrote:
    When I send a message to my federated exchange, two workers (one in each
    cluster) gets the message.

    What do I need to do in order to have only one worker get the message,
    instead of one per federation?

    Federation is currently a poor fit for worker queues since you can only
    federate exchanges; federating an exchange means that messages published
    to that exchange can be consumed in all locations.


    You might be able to rig something up by federating the random or
    consistent hash exchanges, any exchange which will only route to one
    consumer.


    We are working on implementing federated queues, which will hopefully be
    the correct solution for your problem.


    Cheers, Simon


    --
    Simon MacMullen
    RabbitMQ, Pivotal
  • Pete Emerson at Jun 6, 2013 at 3:51 pm
    Whoops, replied back to Simon instead of the list.


    I have a policy of "^amq\." with federation-upstream-set: all, isn't that
    federating the random exchanges already?


    I'm not clear what you mean by "any exchange which will only route to one
    consumer". Are you suggesting that the code route the message to a desired
    consumer, instead of taking advantage of rabbitmq itself?




    On Thu, Jun 6, 2013 at 3:19 AM, Simon MacMullen wrote:

    On 05/06/13 21:03, Pete Emerson wrote:

    When I send a message to my federated exchange, two workers (one in each
    cluster) gets the message.

    What do I need to do in order to have only one worker get the message,
    instead of one per federation?
    Federation is currently a poor fit for worker queues since you can only
    federate exchanges; federating an exchange means that messages published to
    that exchange can be consumed in all locations.

    You might be able to rig something up by federating the random or
    consistent hash exchanges, any exchange which will only route to one
    consumer.

    We are working on implementing federated queues, which will hopefully be
    the correct solution for your problem.

    Cheers, Simon

    --
    Simon MacMullen
    RabbitMQ, Pivotal
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130606/3ee7b787/attachment.htm>
  • Simon MacMullen at Jun 6, 2013 at 4:17 pm

    On 06/06/13 16:51, Pete Emerson wrote:
    Whoops, replied back to Simon instead of the list.

    I have a policy of "^amq\." with federation-upstream-set: all, isn't
    that federating the random exchanges already?

    That federates the built in exchanges. I was talking about using the
    random exchange: https://github.com/jbrisbin/random-exchange

    I'm not clear what you mean by "any exchange which will only route to
    one consumer". Are you suggesting that the code route the message to a
    desired consumer, instead of taking advantage of rabbitmq itself?

    Sorry, I was typing too quickly. I meant "any exchange type which will
    only route to one queue". The random exchange and consistent hash
    exchanges are examples of such types.


    If you federate such an exchange, you'll end up with each message only
    on one node in the federation. But in general federated exchanges are
    designed to make sure that every subscribing queue gets a copy of the
    message - and acknowledgements then only remove the message from the
    queue locally.


    There isn't currently an easy answer for federated worker queues (that's
    why we're working on a federated queue implementation!)


    Cheers, Simon

    On Thu, Jun 6, 2013 at 3:19 AM, Simon MacMullen <simon at rabbitmq.com
    wrote:

    On 05/06/13 21:03, Pete Emerson wrote:

    When I send a message to my federated exchange, two workers (one
    in each
    cluster) gets the message.

    What do I need to do in order to have only one worker get the
    message,
    instead of one per federation?


    Federation is currently a poor fit for worker queues since you can
    only federate exchanges; federating an exchange means that messages
    published to that exchange can be consumed in all locations.

    You might be able to rig something up by federating the random or
    consistent hash exchanges, any exchange which will only route to one
    consumer.

    We are working on implementing federated queues, which will
    hopefully be the correct solution for your problem.

    Cheers, Simon

    --
    Simon MacMullen
    RabbitMQ, Pivotal




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



    --
    Simon MacMullen
    RabbitMQ, Pivotal

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprabbitmq-discuss @
categoriesrabbitmq
postedJun 5, '13 at 8:03p
activeJun 6, '13 at 4:17p
posts4
users2
websiterabbitmq.com
irc#rabbitmq

2 users in discussion

Simon MacMullen: 2 posts Pete Emerson: 2 posts

People

Translate

site design / logo © 2017 Grokbase