use of com.yanghui.elephant.common.protocol.header.CheckTransactionStateResponseHeader in project elephant by yanghuijava.
the class CheckTransactionStateResponseProcessor method processRequest.
@Override
public RemotingCommand processRequest(ChannelHandlerContext ctx, RemotingCommand request) {
log.info("处理回查事务消息状态回应消息:{}", request);
try {
CheckTransactionStateResponseHeader header = (CheckTransactionStateResponseHeader) request.decodeCommandCustomHeader(CheckTransactionStateResponseHeader.class);
super.handleTransactionState(header.getMessageId(), header.getCommitOrRollback());
} catch (Exception e) {
log.error("Check Transaction State Response processor exception:{}", e);
}
return null;
}
use of com.yanghui.elephant.common.protocol.header.CheckTransactionStateResponseHeader in project elephant by yanghuijava.
the class DefaultMQProducerImpl method checkTransactionState.
@Override
public void checkTransactionState(final String address, final String producerGroupe, final Message msg) {
Runnable run = new Runnable() {
@Override
public void run() {
try {
TransactionMQProducer producer = (TransactionMQProducer) defaultMQProducer;
LocalTransactionState localState = producer.getTransactionCheckListener().checkLocalTransactionState(msg);
CheckTransactionStateResponseHeader header = new CheckTransactionStateResponseHeader();
header.setCommitOrRollback(localState.name());
header.setMessageId(msg.getMessageId());
header.setProducerGroup(defaultMQProducer.getProducerGroup());
RemotingCommand request = RemotingCommand.buildRequestCmd(header, RequestCode.CHECK_TRANSACTION_RESPONSE);
mqProducerFactory.getRemotingClient().invokeOneway(address, request, 0);
} catch (Exception e) {
log.error("check transaction state error:{}", e);
}
}
};
this.checkExecutor.submit(run);
}
Aggregations