You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm studying the implementation of this package to understand how it works. My assumption was that if I send a multiple queries to the QueryBus, each implementing AsyncMessage, then they would be resolved concurrently (assuming there are multiple consumers to process them). Is this how it is supposed to work?
After studying the EnqueueMessageProducer I don't think this is the case though. When resolving a query the producer calls $reply = $this->producer->sendCommand($this->commandName, $enqueueMessage, (bool) $deferred); but then immediately calls $reply->receive($this->replyTimeout) which is blocking (according to it's docblock).
But since sendCommand and receive are not separated in the current code, I think multiple queries (as in multiple QueryBus::dispatch() calls) will be resolves sequentially. Is that right? If so, is that intended? Why? Is there any way to resolve the queries concurrently?
The text was updated successfully, but these errors were encountered:
@enumag The query bus can only work with async message producers that don't require a blocking call to receive a response, but instead invoke a callback when a response arrives.
Let's say you use artax in a message producer and have a global amp event loop running, then you could make use of the async API of the query bus.
In a standard PHP environment it's not possible, because the message producer has to block until it receives a response and can resolve the deferred passed to it.
I think your only chance is to not use the query bus but only Enqueue so that you can send multiple queries before blocking.
I'm studying the implementation of this package to understand how it works. My assumption was that if I send a multiple queries to the QueryBus, each implementing AsyncMessage, then they would be resolved concurrently (assuming there are multiple consumers to process them). Is this how it is supposed to work?
After studying the EnqueueMessageProducer I don't think this is the case though. When resolving a query the producer calls
$reply = $this->producer->sendCommand($this->commandName, $enqueueMessage, (bool) $deferred);
but then immediately calls$reply->receive($this->replyTimeout)
which is blocking (according to it's docblock).According to enqueue documentation you should do this:
So when running multiple queries concurrently I'm guessing it should go something like this:
But since
sendCommand
andreceive
are not separated in the current code, I think multiple queries (as in multipleQueryBus::dispatch()
calls) will be resolves sequentially. Is that right? If so, is that intended? Why? Is there any way to resolve the queries concurrently?The text was updated successfully, but these errors were encountered: