mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
refactor & upgrade rocketmq-client version
This commit is contained in:
@@ -16,12 +16,9 @@
|
||||
|
||||
package org.springframework.cloud.alibaba.cloud.examples;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQTransactionListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQLocalTransactionListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQLocalTransactionState;
|
||||
import org.apache.rocketmq.spring.support.RocketMQHeaders;
|
||||
import org.springframework.messaging.Message;
|
||||
|
||||
/**
|
||||
@@ -32,8 +29,7 @@ public class TransactionListenerImpl implements RocketMQLocalTransactionListener
|
||||
@Override
|
||||
public RocketMQLocalTransactionState executeLocalTransaction(Message msg,
|
||||
Object arg) {
|
||||
Object num = ((HashMap) msg.getHeaders().get(RocketMQHeaders.PROPERTIES))
|
||||
.get("USERS_test");
|
||||
Object num = msg.getHeaders().get("test");
|
||||
|
||||
if ("1".equals(num)) {
|
||||
System.out.println(
|
||||
@@ -55,4 +51,4 @@ public class TransactionListenerImpl implements RocketMQLocalTransactionListener
|
||||
System.out.println("check: " + new String((byte[]) msg.getPayload()));
|
||||
return RocketMQLocalTransactionState.COMMIT;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user