Closed
Description
Hi, I am lost with FinalizeGuard
and how to set it up properly. I am not sure if this relates to Laravel package or to MessageBus core.
- I have my query and corresponding finder. On success it resolves Deferred like this:
class QueryFinder {
function __invoke($query, Deferred $deferred = null): void
{
//...
$deferred->resolve($query_result);
}
}
-
I enabled
FinalizeGuard
in prooph.php config file. -
But the result of the query returns null.
// I use facade
$query_result = QueryBus::resultFrom($query);
// $query_result is null now
-
If I disable the
FinalizeGuard
then query returns valid result. So it led me into looking inside of theFinalizeGuard
code. -
Looking at 48 line: https://github.com/prooph/service-bus/blob/c239acfd43cf8eec577e30ce0aa7da86d87b6191/src/Plugin/Guard/FinalizeGuard.php#L48
It creates a new Promise and here it losts resolved result.
It seems that I misuse QueryBus. Can you suggest the right way of resolving Deferred object inside my QueryFinder which works with FinalizeGuard?
Metadata
Metadata
Assignees
Labels
No labels