Search in sources :

Example 26 with AbstractMessageProto

use of io.seata.serializer.protobuf.generated.AbstractMessageProto in project seata by seata.

the class GlobalCommitResponseConvertor method convert2Proto.

@Override
public GlobalCommitResponseProto convert2Proto(GlobalCommitResponse globalCommitResponse) {
    final short typeCode = globalCommitResponse.getTypeCode();
    final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
    final String msg = globalCommitResponse.getMsg();
    final AbstractResultMessageProto abstractResultMessageProto = AbstractResultMessageProto.newBuilder().setMsg(msg == null ? "" : msg).setResultCode(ResultCodeProto.valueOf(globalCommitResponse.getResultCode().name())).setAbstractMessage(abstractMessage).build();
    AbstractTransactionResponseProto abstractTransactionResponseProto = AbstractTransactionResponseProto.newBuilder().setAbstractResultMessage(abstractResultMessageProto).setTransactionExceptionCode(TransactionExceptionCodeProto.valueOf(globalCommitResponse.getTransactionExceptionCode().name())).build();
    AbstractGlobalEndResponseProto abstractGlobalEndResponseProto = AbstractGlobalEndResponseProto.newBuilder().setAbstractTransactionResponse(abstractTransactionResponseProto).setGlobalStatus(GlobalStatusProto.valueOf(globalCommitResponse.getGlobalStatus().name())).build();
    GlobalCommitResponseProto result = GlobalCommitResponseProto.newBuilder().setAbstractGlobalEndResponse(abstractGlobalEndResponseProto).build();
    return result;
}
Also used : AbstractResultMessageProto(io.seata.serializer.protobuf.generated.AbstractResultMessageProto) AbstractGlobalEndResponseProto(io.seata.serializer.protobuf.generated.AbstractGlobalEndResponseProto) GlobalCommitResponseProto(io.seata.serializer.protobuf.generated.GlobalCommitResponseProto) AbstractTransactionResponseProto(io.seata.serializer.protobuf.generated.AbstractTransactionResponseProto) AbstractMessageProto(io.seata.serializer.protobuf.generated.AbstractMessageProto)

Example 27 with AbstractMessageProto

use of io.seata.serializer.protobuf.generated.AbstractMessageProto in project seata by seata.

the class RegisterRMResponseConvertor method convert2Proto.

@Override
public RegisterRMResponseProto convert2Proto(RegisterRMResponse registerRMResponse) {
    final short typeCode = registerRMResponse.getTypeCode();
    final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
    final String msg = registerRMResponse.getMsg();
    // for code
    if (registerRMResponse.getResultCode() == null) {
        if (registerRMResponse.isIdentified()) {
            registerRMResponse.setResultCode(ResultCode.Success);
        } else {
            registerRMResponse.setResultCode(ResultCode.Failed);
        }
    }
    final AbstractResultMessageProto abstractResultMessageProto = AbstractResultMessageProto.newBuilder().setMsg(msg == null ? "" : msg).setResultCode(ResultCodeProto.valueOf(registerRMResponse.getResultCode().name())).setAbstractMessage(abstractMessage).build();
    final String extraData = registerRMResponse.getExtraData();
    AbstractIdentifyResponseProto abstractIdentifyResponseProto = AbstractIdentifyResponseProto.newBuilder().setAbstractResultMessage(abstractResultMessageProto).setExtraData(extraData == null ? "" : extraData).setVersion(registerRMResponse.getVersion()).setIdentified(registerRMResponse.isIdentified()).build();
    RegisterRMResponseProto result = RegisterRMResponseProto.newBuilder().setAbstractIdentifyResponse(abstractIdentifyResponseProto).build();
    return result;
}
Also used : AbstractResultMessageProto(io.seata.serializer.protobuf.generated.AbstractResultMessageProto) AbstractIdentifyResponseProto(io.seata.serializer.protobuf.generated.AbstractIdentifyResponseProto) RegisterRMResponseProto(io.seata.serializer.protobuf.generated.RegisterRMResponseProto) AbstractMessageProto(io.seata.serializer.protobuf.generated.AbstractMessageProto)

Aggregations

AbstractMessageProto (io.seata.serializer.protobuf.generated.AbstractMessageProto)27 AbstractResultMessageProto (io.seata.serializer.protobuf.generated.AbstractResultMessageProto)12 AbstractTransactionRequestProto (io.seata.serializer.protobuf.generated.AbstractTransactionRequestProto)11 AbstractTransactionResponseProto (io.seata.serializer.protobuf.generated.AbstractTransactionResponseProto)10 AbstractGlobalEndRequestProto (io.seata.serializer.protobuf.generated.AbstractGlobalEndRequestProto)4 AbstractGlobalEndResponseProto (io.seata.serializer.protobuf.generated.AbstractGlobalEndResponseProto)4 Any (com.google.protobuf.Any)2 Message (com.google.protobuf.Message)2 AbstractMessage (io.seata.core.protocol.AbstractMessage)2 AbstractBranchEndRequestProto (io.seata.serializer.protobuf.generated.AbstractBranchEndRequestProto)2 AbstractBranchEndResponseProto (io.seata.serializer.protobuf.generated.AbstractBranchEndResponseProto)2 AbstractIdentifyRequestProto (io.seata.serializer.protobuf.generated.AbstractIdentifyRequestProto)2 AbstractIdentifyResponseProto (io.seata.serializer.protobuf.generated.AbstractIdentifyResponseProto)2 BranchRegisterRequestProto (io.seata.serializer.protobuf.generated.BranchRegisterRequestProto)2 ArrayList (java.util.ArrayList)2 AbstractResultMessage (io.seata.core.protocol.AbstractResultMessage)1 MergeResultMessage (io.seata.core.protocol.MergeResultMessage)1 MergedWarpMessage (io.seata.core.protocol.MergedWarpMessage)1 BranchCommitRequestProto (io.seata.serializer.protobuf.generated.BranchCommitRequestProto)1 BranchCommitResponseProto (io.seata.serializer.protobuf.generated.BranchCommitResponseProto)1