use of com.yanghui.elephant.common.protocol.header.EndTransactionRequestHeader in project elephant by yanghuijava.
the class DefaultMQProducerImpl method endTransaction.
private void endTransaction(SendResult sendResult, LocalTransactionState localState, Throwable localException) throws InterruptedException, RemotingSendRequestException, RemotingTimeoutException, RemotingConnectException {
EndTransactionRequestHeader requestHeader = new EndTransactionRequestHeader();
requestHeader.setMsgId(sendResult.getMsgId());
requestHeader.setProducerGroup(this.defaultMQProducer.getProducerGroup());
requestHeader.setCommitOrRollback(localState.name());
RemotingCommand request = RemotingCommand.buildRequestCmd(requestHeader, RequestCode.END_TRANSACTION);
if (localException != null) {
request.setRemark("executeLocalTransactionBranch exception: " + localException.toString());
}
this.mqProducerFactory.getRemotingClient().invokeOneway(choiceOneServer(), request, this.defaultMQProducer.getSendMsgTimeout());
}
use of com.yanghui.elephant.common.protocol.header.EndTransactionRequestHeader in project elephant by yanghuijava.
the class EndTransactionMessageProcessor method processRequest.
@Override
public RemotingCommand processRequest(ChannelHandlerContext ctx, RemotingCommand request) {
log.info("处理结束事务消息:{}", request);
try {
EndTransactionRequestHeader requestHeader = (EndTransactionRequestHeader) request.decodeCommandCustomHeader(EndTransactionRequestHeader.class);
super.handleTransactionState(requestHeader.getMsgId(), requestHeader.getCommitOrRollback());
} catch (Exception e) {
log.error("EndTransaction message processor exception:{}", e);
}
return null;
}
Aggregations