File tree Expand file tree Collapse file tree
apache-rocketmq/src/main/java/com/baeldung/rocketmq/transaction Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package com .baeldung .rocketmq .transaction ;
2+
3+ import org .apache .rocketmq .spring .annotation .RocketMQTransactionListener ;
4+ import org .apache .rocketmq .spring .core .RocketMQLocalTransactionListener ;
5+ import org .apache .rocketmq .spring .core .RocketMQLocalTransactionState ;
6+ import org .springframework .messaging .Message ;
7+
8+ @ RocketMQTransactionListener (txProducerGroup = "test-transaction" )
9+ class TransactionListenerImpl implements RocketMQLocalTransactionListener {
10+ @ Override
11+ public RocketMQLocalTransactionState executeLocalTransaction (Message msg , Object arg ) {
12+ // ... local transaction process, return ROLLBACK, COMMIT or UNKNOWN
13+ return RocketMQLocalTransactionState .UNKNOWN ;
14+ }
15+
16+ @ Override
17+ public RocketMQLocalTransactionState checkLocalTransaction (Message msg ) {
18+ // ... check transaction status and return ROLLBACK, COMMIT or UNKNOWN
19+ return RocketMQLocalTransactionState .COMMIT ;
20+ }
21+ }
You can’t perform that action at this time.
0 commit comments