Messaging becomes really interesting when you process your messages asynchronous. For example push your messages on a database queue, set up a cron job to periodically check the queue for new messages and process them. The bus implementations of PSB can hide such an asynchronous workflow behind a unified interface. You can start with synchronous message dispatching by routing your messages directly to message handlers and if you later want to improve response times you can switch to async processing on a per message basis by routing the appropriate messages to a Async\MessageProducer listed below.
- BernardProducer: Queue multi-backend providing different drivers like Doctrine DBAL and Predis (see http://bernardphp.com for a complete list of drivers)
- GuzzleHttpProducer: Send messages to a remote system using HTTP
- ZeromqProducer: Async message handling using super fast and simple to set up ZeroMQ
If you want to set up a bus that handles all messages async you can do so by attaching a MessageProducerPlugin initialized with your message producer of choice to a message bus.
If you want to decide on a per message basis if the message should be handled async you can use a normal message router and configure your message producer of choice as message handler for the appropriate messages.
Note: The RegexRouter is a good choice if you want to handle all messages of a specific namespace async.
A async message producer for the QueryBus needs to provide a response by resolving the handed over deferred. In a messaging system based on ZeroMQ for example you can make use of request/response mode. HTTP APIs provide responses naturally. So these are both good candidates to use for remote querying.