Handler receives the envelope instead of the message it was registered for
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- PHP
- Star
- 61
- Fork
- 31
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của yiisoft/queue
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
-
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 47/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 54/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Tất cả issue của yiisoft/queue
Issue tương tự
-
loginWithCustomTokenExchange() fails when an organization is configuredCó thể đã có người làm @awss1i đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
auth0/auth0-PHP#883 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
type/bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
flarum/framework#5231 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
major-release
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 67/100
Intervention/image#1553 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
omegaup/omegaup#10353 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 61/100