/// <summary>
 /// Creates a new ScsResultMessage object with Data property.
 /// </summary>
 /// <param name="Data">Message data that is being transmitted</param>
 public ScsResultMessage(MessageBase value)
 {
     this.MessageValue = value;
 }
 /// <summary>
 /// Creates a new reply ScsResultMessage object with Data property.
 /// </summary>
 /// <param name="Data">Message data that is being transmitted</param>
 /// <param name="repliedMessageId">
 /// Replied message id if this is a reply for
 /// a message.
 /// </param>
 public ScsResultMessage(MessageBase value, string repliedMessageId)
     : this(value)
 {
     RepliedMessageId = repliedMessageId;
 }
Exemplo n.º 3
0
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="client"></param>
        /// <param name="msgBase"></param>
        /// <param name="messageId"></param>
        private void SendMessage(IScsServerClient client, MessageBase msgBase, string messageId)
        {
            try
            {
                var sendMsg = new ScsResultMessage(msgBase, messageId);

                //发送消息
                client.SendMessage(sendMsg);
            }
            catch (Exception ex)
            {
                //写异常日志
                container.Write(ex);

                try
                {
                    msgBase = new ResponseMessage
                    {
                        TransactionId = msgBase.TransactionId,
                        ReturnType = msgBase.ReturnType,
                        ServiceName = msgBase.ServiceName,
                        MethodName = msgBase.MethodName,
                        Parameters = msgBase.Parameters,
                        Error = ex
                    };

                    var sendMsg = new ScsResultMessage(msgBase, messageId);

                    //发送消息
                    client.SendMessage(sendMsg);
                }
                catch
                {
                    //写异常日志
                    container.Write(ex);
                }
            }
        }