Handler receives the envelope instead of the message it was registered for
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 35/100
Direção de pesquisa
Read Worker.php, ConsumeFinalHandler.php, and the guide at docs/guide/en/messages-and-handlers.md:108; trace how IdEnvelope, DelayEnvelope, and FailureEnvelope move through the consume pipeline. First resolve the contract choice raised in the issue, especially alongside the #338 Worker and pipeline rework. Done means handlers receive the intended message or envelope contract consistently, with the guide and behavior agreeing.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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):
public function handle(MessageInterface $message): void
{
assert($message instanceof SendEmailMessage);
$this->mailer->send($message->to, $message->subject, $message->body);
}
Called with an adapter-assigned id, which is the normal asynchronous path:
$worker->process(new IdEnvelope($message, 'id-42'), 'test');
With zend.assertions=1:
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
Workerbefore 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), sinceassert()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.
- Linguagem predominante
- PHP
- Estrelas
- 61
- Forks
- 31
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de yiisoft/queue
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
-
Dificuldade 4/5 1-2 dias Facilidade para iniciantes 47/100
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 54/100
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 45/100
Todas as issues de yiisoft/queue
Issues semelhantes
-
loginWithCustomTokenExchange() fails when an organization is configuredTalvez já em andamento @awss1i assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
auth0/auth0-PHP#883 · 1 comentário ·
Mantenedores costumam responder em até 2 dias
-
type/bug
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 75/100
flarum/framework#5231 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
major-release
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 67/100
Intervention/image#1553 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
omegaup/omegaup#10353 · 1 comentário ·
Mantenedores costumam responder em até 5 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 61/100