File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -268,6 +268,7 @@ do is to write your own CSV receiver::
268
268
269
269
use App\Message\NewOrder;
270
270
use Symfony\Component\Messenger\Envelope;
271
+ use Symfony\Component\Messenger\Exception\MessageDecodingFailedException;
271
272
use Symfony\Component\Messenger\Transport\Receiver\ReceiverInterface;
272
273
use Symfony\Component\Serializer\SerializerInterface;
273
274
@@ -291,7 +292,15 @@ do is to write your own CSV receiver::
291
292
return [];
292
293
}
293
294
294
- // Reject the message if needed
295
+ try {
296
+ $envelope = $this->serializer->decode([
297
+ 'body' => $yourEnvelope['body'],
298
+ 'headers' => $yourEnvelope['headers'],
299
+ ]);
300
+ } catch (MessageDecodingFailedException $exception) {
301
+ $this->connection->reject($yourEnvelope['id']);
302
+ throw $exception;
303
+ }
295
304
296
305
return [$yourEnvelope->with(new CustomStamp($yourEnvelope['id']);
297
306
}
@@ -303,7 +312,8 @@ do is to write your own CSV receiver::
303
312
304
313
public function reject(Envelope $envelope): void
305
314
{
306
- // Reject the message if needed
315
+ // In the case of a custom connection
316
+ $this->connection->reject($this->findCustomStamp($envelope)->getId());
307
317
}
308
318
}
309
319
You can’t perform that action at this time.
0 commit comments