A router is responsible for initializing and holding all event modules, connecting their queues and organize the event flow between them.

The router object plays a central role in the Wishbone setup. When bootstrapping an instances using the CLI tooling you are not really exposed to it (though the routing table might give a hint), however if you create a server directly in Python you will always first have to initialize a Router instance:

input_config = ActorConfig("input")
output_config = ActorConfig("output")

router = Default()
router.registerModule(TestEvent, input_config, {"message": "Hello world!"})
router.registerModule(STDOUT, output_config)
router.connectQueue("input.outbox", "output.inbox")

Multiple routers can be initialized which run inside the same process.

from import ActorConfig
from wishbone.router import Default
from wishbone.module.testevent import TestEvent
from wishbone.module.stdout import STDOUT

input_config = ActorConfig("input")
output_config = ActorConfig("output")

router_1 = Default()
router_1.registerModule(TestEvent, input_config, {"message": "Hello world from router instance 1!"})
router_1.registerModule(STDOUT, output_config)
router_1.connectQueue("input.outbox", "output.inbox")

router_2 = Default()
router_2.registerModule(TestEvent, input_config, {"message": "Hello world from router instance 2!"})
router_2.registerModule(STDOUT, output_config)
router_2.connectQueue("input.outbox", "output.inbox")

$ python
Hello world from router instance 1!
Hello world from router instance 2!
Hello world from router instance 1!
Hello world from router instance 2!
Hello world from router instance 1!
Hello world from router instance 2!


If desired, multiple Router instances can each run into their own Process using gipc. This is what wishbone.bootstrap.Dispatch does.

Wishbone comes with the default wishbone.router.default.Default router implementation.

class wishbone.router.default.Default(config=None, size=100, frequency=10, identification='wishbone', graph=False, graph_include_sys=False)[source]

The default Wishbone router.

A Wishbone router is responsible for organising the event flow between modules.

  • config – The router setup configuration.
  • size – The size of all queues.
  • frequency – The frequency at which metrics are produced.
  • identification – A string identifying this instance in logging.

Blocks until stop() is called and the shutdown process ended.

connectQueue(source, destination)[source]

Connects one queue to the other.

For convenience, the syntax of the queues is <modulename>.<queuename> For example:


This type of router actually replaces the destination queue with the source queue.

  • source – The source queue in <module.queue_name> syntax
  • destination – The destination queue in <module.queue_name> syntax

Returns all the connected child modules

Parameters:module – The name of the module.
Returns:A list of module names.
Return type:list
registerModule(module, actor_config, arguments={})[source]

Initializes the wishbone module module.

  • module – A Wishbone module component name.
  • actor_config – The module’s actor configuration
  • arguments – The parameters to initialize the module.

Starts all registered modules.


Stops all running modules.