private static void mqCALCMQClientClient_ActionEventMessage(EventMessageResult result) { if (result.EventMessageBytes.EventMessageMarkcode == "CALC") { var message = MessageSerializerFactory.CreateMessageSerializerInstance("json") .DeserializeByte<object>(result.MessageBytes); result.IsOperationOk = true; //处理成功 Console.WriteLine(message.ToString()); } }
/// <summary> /// 生成EventMessageResult对象。 /// </summary> /// <param name="bytes">流</param> /// <returns>EventMessageResult instance.</returns> internal static EventMessageResult BuildEventMessageResult(byte[] bytes) { var eventMessage = MessageSerializerFactory.CreateMessageSerializerInstance("json").DeserializeByte <EventMessage>(bytes); var result = new EventMessageResult { MessageBytes = eventMessage.EventMessageBytes, EventMessageBytes = eventMessage }; return(result); }