Example #1
0
        /// <summary>状态修改事件</summary>
        /// <param name="database">数据库</param>
        /// <param name="entity">实体</param>
        /// <param name="oType">操作</param>
        /// <param name="valueType">值类型</param>
        /// <param name="value">内容</param>
        /// <remarks>
        /// 如果内容为实体,使用JSON序列化,
        /// 如果使用主键内容为#:[key](如:#:123)样式,
        /// 如果为批量操作,内容为QueryCondition的JSON序列化
        /// </remarks>
        void IEntityEventProxy.OnStatusChanged(string database, string entity, DataOperatorType oType, EntityEventValueType valueType, string value)
        {
            var arg = JsonConvert.SerializeObject(new EntityEventArgument
            {
                OperatorType = oType,
                ValueType    = valueType,
                Value        = value
            });
            bool re = MessageQueue.Publish("EntityEvent", database, entity, arg);

            LogRecorder.Debug($@"EntityEvent : {database}, {entity},{re}
{arg}");
        }
Example #2
0
 private void SendCallback(IAsyncResult ar)
 {
     try
     {
         Socket handler   = (Socket)ar.AsyncState;
         int    bytesSent = handler.EndSend(ar, out errorCode);
         LogRecorder.Debug(string.Format("Request to {0} success.", handler.RemoteEndPoint));
         if (errorCode != SocketError.Success)
         {
             LogRecorder.Error(String.Format("{0}() throw an exception:{1}", System.Reflection.MethodBase.GetCurrentMethod().Name, errorCode.ToString()));
         }
     }
     catch (Exception)
     {
         throw;
     }
 }