BAEL-3457 Apache RocketMq
This commit is contained in:
parent
d6330507ff
commit
ba4ca46e2a
|
@ -0,0 +1,21 @@
|
||||||
|
package com.baeldung.rocketmq.transaction;
|
||||||
|
|
||||||
|
import org.apache.rocketmq.spring.annotation.RocketMQTransactionListener;
|
||||||
|
import org.apache.rocketmq.spring.core.RocketMQLocalTransactionListener;
|
||||||
|
import org.apache.rocketmq.spring.core.RocketMQLocalTransactionState;
|
||||||
|
import org.springframework.messaging.Message;
|
||||||
|
|
||||||
|
@RocketMQTransactionListener(txProducerGroup = "test-transaction")
|
||||||
|
class TransactionListenerImpl implements RocketMQLocalTransactionListener {
|
||||||
|
@Override
|
||||||
|
public RocketMQLocalTransactionState executeLocalTransaction(Message msg, Object arg) {
|
||||||
|
// ... local transaction process, return ROLLBACK, COMMIT or UNKNOWN
|
||||||
|
return RocketMQLocalTransactionState.UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RocketMQLocalTransactionState checkLocalTransaction(Message msg) {
|
||||||
|
// ... check transaction status and return ROLLBACK, COMMIT or UNKNOWN
|
||||||
|
return RocketMQLocalTransactionState.COMMIT;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue