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
{{ message }}
Repository navigation
Handler receives the envelope instead of the message it was registered for #341
Worker::process() passes the message into the consume pipeline exactly as it arrived, and ConsumeFinalHandler hands that to the handler. Nothing unwraps an envelope on the way, so a handler written the way the guide writes it breaks as soon as the message is wrapped.
The documented handler (docs/guide/en/messages-and-handlers.md:108):
MessageFailureException: Processing of message #id-42 is stopped because of an exception:
assert($message instanceof SendEmailMessage).
With zend.assertions=-1, the production default:
Warning: Undefined property: Yiisoft\Queue\Message\IdEnvelope::$to
sending to: NULL
No error, and the work is done against empty values. DelayEnvelope and FailureEnvelope behave the same way. Call path: Worker.php:45 → ConsumeMiddlewareDispatcher → ConsumeFinalHandler.php:21.
Worth deciding which contract is meant:
unwrap in Worker before dispatching, so a handler always receives the message type it was registered for, and offer the envelope separately to handlers that want the metadata, or
keep passing the envelope and change every handler example in the guide to unwrap first ($message instanceof Envelope ? $message->getMessage() : $message), since assert() is not a guard in production.
InMemoryAdapter happens not to trigger this because it stores the unwrapped message, but any adapter that stores what push() returned does.
#338 reworks Worker and the pipeline around it, so this probably wants deciding before that lands.
Activity