Transaction support #558
Closed
jonas-grgt
started this conversation in
General
Replies: 2 comments
-
Thanks for starting the discussion @jonasgeiregat . We have done some preliminary design which IIRC lines up w/ your suggestion. I was planning on continuing w/ this in the next 1-2 weeks. Let me get back into the design and then we can sync up. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Doing a bit of GH discussions housekeeping... Since this has been implemented starting in Thanks @jonas-grgt for the discussion. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been looking into how spring-pulsar could support transactions.
The main hurdle to overcome will be sharing the
Transaction
details between thePulsarMessageListenerContainer
andPulsarTemplate
as both the pulsarConsumer
(throughacknowledgeAsync
) andProducer
(throughnewMessage(txn)
) need access to theTransaction
.To give a more concrete example, imagine the consume, process, and produce messages in one atomic operation use-case.
In such a scenario there is no way to access the
Transaction
from within an applications listener method.One way to solve this would be to pass in the
Transaction
as a parameter in the listener method together with a transaction parameter in the@PulsarListener
annotation.This way the
PulsarMessageListenerContainer
would know when to initiate a transaction, get the transaction from thePulsarClient
. Pass theTransaction
in to the listener method. And at the end commit the transaction and acknowledge the consumption or rollback (throughConsumer.negativeAcknowledge()
andTransaction.abort()
)The same would go for the
@ReactivePulsarListener
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions