1

I want to implement a "bus" over which python processes can communicate. The "bus" B shall run as a python process. Other Python processes C1, C2, ...Cn shall be able to register to the bus by a name. After registration it shall be possible for C1 to send a message to C2 by passing a message to the bus together with the name for C2. The Bus shall then route the message to C2. C2 can receive the message in its own Queue object.

I feel, that the multiprocessing package is somehow suited for such task, but I have no idea how to pass the required message queue of C2 to the BUS process upon registration, because all shared objects must be communicated to BUS upon its creation (args). The only idea I have at the moment is to reserve a pool of message queues and pass that to the BUS process initially.

Is there a better solution for that requirement? Maybe there is a package i dont know...

Thanks

asked Jul 1, 2016 at 10:37
1
  • How are the bus the chatting processes spawned? You have a "main" script that instantiates the bus and then the other processes? Commented Sep 17, 2017 at 18:09

1 Answer 1

1

If you want to start all processes (c1,c2,bus) separately. Then you should use FIFOs or Unix Sockets to communicate.

Pipes and Queues in multiprocessing package, applicable only if you can send copy of pipe to child process when you spawn it

answered Jul 1, 2016 at 13:58
Sign up to request clarification or add additional context in comments.

1 Comment

Note that FIFOs do not exists in windows

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.