forked from eugenp/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Krzysztof Majewski
committed
Dec 4, 2019
1 parent
203a594
commit 622bd50
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
apache-rocketmq/src/main/java/com/baeldung/rocketmq/transaction/TransactionListenerImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |