0

誰かがpidbox.Mailboxを使用しましたか?

私はその例に似た何かをしようとしていますが、そのドキュメントはかなり古くなっています。私はなんとかdjangoトランスポートへのメッセージを公開するものを手に入れることができましたが、そこからメッセージが正常に受信されることはありません。

誰かがこれの使い方を知っていて、うまく電話/キャストする方法の例を教えてくれることを望んでいました。

これが私が持っているものです(ダミーノードは実際には印刷やリストだけでは何もしません):

    #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()

そして、シンプルなクライアント。

#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)
4

1 に答える 1

0

これに対する答えは明らかにノーです。この投稿に出くわした場合は、自分で書くことを強くお勧めします。pidboxのドキュメントが少なすぎて、そこにあるドキュメントは古くなっています。

于 2011-06-08T21:48:47.377 に答える