Replies: 6 comments 4 replies
-
That's an interesting problem. AFAIK sync transport was created mainly for testing purpose. Basically sync transport is just like no transport at all, it's a synchronous code execution so at the first glance it should not be surprising that the whole process crashes. However I agree that we can discuss whether the behavior of sync transport in context of failed messages should be redefined. |
Beta Was this translation helpful? Give feedback.
-
I llike the option to make it configurable, but I would prefer if the default behavior were changed. Another problem with the current behavior is that the event WorkerMessageFailedEvent is never triggered for the sync transport. |
Beta Was this translation helpful? Give feedback.
-
Just stumble over this. In my case the |
Beta Was this translation helpful? Give feedback.
-
For my use case, I think it makes sense to retain the current behaviour of crashing the whole process or making it configurable, so this behaviour can be retained. I have message handlers where a synchronous handler records some domain interaction, and a series of queued asynchronous handlers provision a number of resources that follow from that interaction. Occasionally the synchronous handler may throw some invariant exception, where all of the resources provisioned asynchronously should be halted and discarded. A "safe-sync://" transport would be a good way to support both use cases. |
Beta Was this translation helpful? Give feedback.
-
sync:// dsn + retry_strategy/failure_transport should work as expected IMHO |
Beta Was this translation helpful? Give feedback.
-
My use-case is to make an automatic retry mechanism for deadlocks and lock wait timeouts using the |
Beta Was this translation helpful? Give feedback.
-
Hello there,
A few weeks ago, one of the projects I was working on had issues with concurrent operations on a
messenger
queue (context: several workers on several machines, using theredis
transport). As some messages had to be processed sequentially (e.g. not simultaneously by several workers), we decided to temporarily switch theredis
transport tosync://
.Surprisingly, with
sync://
:So a synchronous transport cannot be a drop-in replacement of an asynchronous one, even though they share the same contract (that's why I had the same expectations). As a workaround, I crafted a
safe-sync://
transport*: it acts synchronously, but behaves like an async transport would: whenever a message processing fails, it retries it, then eventually moves it to afailed
transport, and the PHP process can come to its expected end.* It's a proof-of-concept that I never used in production - we found another, domain-related solution
20 votes ·
Beta Was this translation helpful? Give feedback.
All reactions