static string ProtoMessageToString(ProtoMessage msg)
        {
            if (!msg.HasPayload)
            {
                return("ERROR in ProtoMessage: Corrupted execution event, no payload found");
            }
            var _str = "ProtoMessage{";

            switch ((ProtoPayloadType)msg.PayloadType)
            {
            case ProtoPayloadType.PROTO_MESSAGE:
                var _msg = ProtoMessage.CreateBuilder().MergeFrom(msg.Payload).Build();
                _str += ProtoMessageToString(_msg);
                break;

            case ProtoPayloadType.HEARTBEAT_EVENT:
                var _hb = ProtoHeartbeatEvent.CreateBuilder().MergeFrom(msg.Payload).Build();
                _str += "Heartbeat";
                break;

            case ProtoPayloadType.ERROR_RES:
                var _err = ProtoErrorRes.CreateBuilder().MergeFrom(msg.Payload).Build();
                _str += "ErrorResponse{errorCode:" + _err.ErrorCode + (_err.HasDescription ? ", description:" + _err.Description : "") + "}";
                break;

            default:
                _str += OpenApiMessageToString(msg);
                break;
            }

            _str += (msg.HasClientMsgId ? ", clientMsgId:" + msg.ClientMsgId : "") + "}";

            return(_str);
        }
예제 #2
0
        private void Process_Error_Res()
        {
            ProtoErrorRes args = Serializer.Deserialize <ProtoErrorRes>(_processorMemoryStream);

            Log.Info("ProtoErrorRes: " +
                     $"errorCode: {args.errorCode}; " +
                     $"Description: {args.Description}; " +
                     $"maintenanceEndTimestamp: {args.maintenanceEndTimestamp} ({EpochToString((long) args.maintenanceEndTimestamp)}");

            OnErrorResReceived?.Invoke(args);
        }
        static string ProtoMessageToString(ProtoMessage msg)
        {
            if (!msg.HasPayload)
            {
                return("ERROR in ProtoMessage: Corrupted execution event, no payload found");
            }
            var _str = "ProtoMessage{";

            switch ((ProtoPayloadType)msg.PayloadType)
            {
            //case ProtoPayloadType.PROTO_MESSAGE: // FIXME - was this working?
            //    var _msg = ProtoMessage.CreateBuilder().MergeFrom(msg.Payload).Build();
            //    _str += ProtoMessageToString(_msg);
            //    break;
            case ProtoPayloadType.PING_REQ:
                var _ping_req = ProtoPingReq.CreateBuilder().MergeFrom(msg.Payload).Build();
                _str += "PingRequest{timestamp:" + _ping_req.Timestamp.ToString() + "}";
                break;

            case ProtoPayloadType.PING_RES:
                var _ping_res = ProtoPingRes.CreateBuilder().MergeFrom(msg.Payload).Build();
                _str += "PingResponse{timestamp:" + _ping_res.Timestamp + "}";
                break;

            case ProtoPayloadType.HEARTBEAT_EVENT:
                var _hb = ProtoHeartbeatEvent.CreateBuilder().MergeFrom(msg.Payload).Build();
                _str += "Heartbeat";
                break;

            case ProtoPayloadType.ERROR_RES:
                var _err = ProtoErrorRes.CreateBuilder().MergeFrom(msg.Payload).Build();
                _str += "ErrorResponse{errorCode:" + _err.ErrorCode + (_err.HasDescription ? ", description:" + _err.Description : "") + "}";
                break;

            default:
                _str += OpenApiMessageToString(msg);
                break;
            }
            _str += (msg.HasClientMsgId ? ", clientMsgId:" + msg.ClientMsgId : "")
                    //+ (msg.HasPayloadString ? ", payloadString:" + msg.PayloadString : "")  // FIXME - was this working?
                    + "}";

            return(_str);
        }
 public ProtoErrorRes GetErrorResponse(byte[] msg = null)
 {
     return(ProtoErrorRes.CreateBuilder().MergeFrom(GetPayload(msg)).Build());
 }