WIP: Added transactional support to configuration.
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();
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.
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.