sroze / messenger-enqueue-transport

Uses Enqueue with Symfony's Messenger component.
MIT License
191 stars 55 forks source link

On exceptions the message should not be requeued? #34

Closed malheirosrafa closed 6 years ago

malheirosrafa commented 6 years ago

On exceptions the QueueInteropTransport should not requeue the message instead of rejected it?

If this is the correct behaviour, how can I make the message at least not be rejected, to let te visibility timeout of AWS SQS set the message visible again?

makasim commented 6 years ago

Add one more transport specific exception to workaround messenger abstraction.

malheirosrafa commented 6 years ago

Can you give me some tips on how can I do it? Eg: if the database timedout, I can't throw that transport specific exception (In my application domain). Sorry if I don't understand what you had said, I'm a beginner developer.

makasim commented 6 years ago

Btw enqueue itself does not get in your way. If you do not catch exception it will be redelivered once visibility timeout. If you catch it you can decide what to do: ack, reject or requeue.

malheirosrafa commented 6 years ago

That's the problem, it I'm not catching the exception and it is not being redelivered on visibility timeout.

makasim commented 6 years ago

yeap it's because transport is trying to be smart https://github.com/php-enqueue/messenger-adapter/blob/master/QueueInteropTransport.php#L99

Markoshd commented 6 years ago

hey, i've got the same problem. Did u solve your problem @malheirosrafa ? because I could not really understand the explanation given since for me it was the same Post you've made @makasim, the best way to solve is to extend the SQS Transport and override the Receive method? if so, can you post some examples yourself?