Skip to content

WIP: Added transactional support to configuration. #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

majusko
Copy link
Owner

@majusko majusko commented May 19, 2021

No description provided.

@majusko majusko linked an issue May 19, 2021 that may be closed by this pull request
@Wanxp
Copy link

Wanxp commented Jun 25, 2021

I review your code, and have a question: how do we use transaction?
Your code just enable transaction, but do not add fuction to use it. this project just provide PulsarTemplate to send message, not support transaction.

in pulsar offical java demo here is example:

Transaction txn = pulsarClient
        .newTransaction()
        .withTransactionTimeout(5, TimeUnit.MINUTES)
        .build()
        .get();
//producer
producer.newMessage(txn).value("Hello Pulsar Transaction".getBytes()).sendAsync();
txn.commit().get();

//consumer
Message<byte[]> message = consumer.receive();
consumer.acknowledgeAsync(message.getMessageId(), txn);
txn.commit().get();

@majusko
Copy link
Owner Author

majusko commented Aug 16, 2021

Hi @Wanxp , I still didn't design the way how the transaction will work. This PR is just about to make the configuration work and so people can use raw pularClient in case they wish to implement transactions alongside the library. I realised some issue during testing so didn't merge but left the PR so I won't forget to check it again. Feel free to contribute and suggest some way it would work. Thank you for your code, it makes sense to me how the transaction works so I think it won't be that complicated to implement it.

@majusko majusko changed the title Added transactional support to configuration. WIP: Added transactional support to configuration. Aug 16, 2021
@grubeninspekteur
Copy link

Ideally, this should be tied to the @Transactional scope of Spring. The way it works for JMS (if not using JTA) is by registering a callback at TransactionSynchronizationManager (if a transaction is active at all) so the message will only be sent if the enclosing transaction (e.g. database) committed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need transaction support
3 participants