PyRSMQ icon indicating copy to clipboard operation
PyRSMQ copied to clipboard

Implement get_transaction method on sendMessage

Open yehonatanz opened this issue 5 years ago • 2 comments
trafficstars

While we're dealing with transactions, I though it would be great to expose sendMessage transactions. This would allow storing job data in redis and publishing it to consumers in one atomic transaction and avoid "orphan" jobs that may occur on producer failures with non atomic transactions.

yehonatanz avatar Nov 11 '20 21:11 yehonatanz

Thanks for your contributions. It seems like it may be worthwhile to implement this pattern across all the transactions for sake of consistency and flexibility

mlasevich avatar Nov 12 '20 15:11 mlasevich

Thanks for your contributions. It seems like it may be worthwhile to implement this pattern across all the transactions for sake of consistency and flexibility

Makes sense. However, this got me thinking: the transaction yielded here is somewhat non confusing - it uses the server time in the transaction creation, not execution. That's ok, but might be confusing, since the visibility timeout would be relative to that time, and not to the message send time. This is fine as long as you create the transaction right before you send it and prepares all the other actions ahead of time, but it's no very intuitive. That might also be the case in some other methods. I'm not sure what we should do here and whether this can be improved. Any thoughts?

yehonatanz avatar Nov 20 '20 19:11 yehonatanz