0

Has anyone used pidbox.Mailbox ?

I am attempting to do something similar to that example, but that documentation is way out of date. I have managed to get something that pubishes messages to a django transport but from there they never are successfuly received.

I was hoping that someone knows how to use this, and could show me an example of how to successfuly call/cast.

Here is what I have(dummy node really does nothing just prints or lists):

    #node/server
    mailbox = pidbox.Mailbox("test", type="direct")
    connection  = BrokerConnection(transport="django")

    bound = mailbox(connection)

    state = {"node": DummyNode(),
                "connection": connection
        }

    node = bound.Node(state = state)

    @node.handler
    def list( state, **kwargs):
        print 'list called'
        return state["node"].list()
    @node.handler
    def connection_info(state, **kwargs):
        return {"connection": state["connection"].info()}
    @node.handler
    def print_msg(state, **kwargs):
        print 'Node handler!'
        state["node"].print_msg(kwargs)


    consumer = node.listen(channel = connection.channel())
    try:
        while not self.killed:
            print 'Consumer Waiting'
            connection.drain_events()
    finally:
        consumer.cancel()

And a simple client.

#client:    

mailbox = pidbox.Mailbox("test", type="direct")
connection  = BrokerConnection(transport="django")
bound = mailbox(connection)

bound.cast(["localhost"], "print_msg", {'msg' : 'Message for you'})
info = bound.call(["test_application"],"list", callback=callback)
Cœur
  • 37,241
  • 25
  • 195
  • 267
Nix
  • 57,072
  • 29
  • 149
  • 198
  • it looks correct when I glance over it, but what isn't working exactly? – asksol Mar 26 '11 at 21:31
  • In 3 words or less: nothing is working. No messages are received, and no responses returned. I was able to hack at it for a while and get one way communications working with the django transport, but its not worth it, so I am in the process of writing my own. Are you saying you have successfully used this product? – Nix Mar 28 '11 at 14:34
  • Celery (http://celeryproject.org) uses pidbox for remote control of worker processes. But I can see now why it is not working for you, you are using the "django" transport, which does not support fanout exchanges (broadcast). See here http://kombu.me/introduction.html#transport-comparison – asksol Mar 28 '11 at 19:32
  • Interesting, well thank your for your help, I still dont believe that if even with RabitMQ the example would have worked. I had to write a lot more code then they showed in order to get it to work with the django transport.... (things like declaring the queues/exchanges binding etc... a lot of boilerplate code) – Nix Mar 28 '11 at 19:38

1 Answers1

0

The answer to this is apparently no. If you come across this post I highly recommend writing your own. There is too little documentation for pidbox, and the documentation that is there is out of date.

Nix
  • 57,072
  • 29
  • 149
  • 198