예제 #1
0
        private void mPublishMsg(XMessage msg)
        {
            if (msg == null)
            {
                return;
            }
            if (msg.StackFrameIndex > 0)
            {
                msg.MsgMethod = getMsgMethodName(msg.StackFrameIndex + 1);
            }
            else
            {
                msg.MsgMethod = getMsgMethodName(1);
            }

            if (string.IsNullOrWhiteSpace(msg.MsgTopic))
            {
                msg.MsgTopic = msg.MsgMethod;
            }
            foreach (var subscriber in this.topiccallbacks.Values)
            {
                try
                {
                    if ((!isSubscribed(subscriber.Topic, msg.MsgTopic, true)) &&
                        (!isSubscribed(subscriber.Method, msg.MsgMethod, false)))
                    {
                        continue;
                    }
                    subscriber.Callback?.Invoke(subscriber, msg);
                }
                catch (Exception ex)
                {
                }
            }
        }
예제 #2
0
 public void Publish(XMessage msg)
 {
     if (msg == null)
     {
         return;
     }
     msg.StackFrameIndex = msg.StackFrameIndex + 1;
     XMQSession.Current.Publish(msg);
 }
예제 #3
0
 public void Publish(XMessage msg)
 {
     try
     {
         mPublishMsg(msg);
     }
     catch (Exception ex)
     {
     }
 }
예제 #4
0
        private void xLogMsg(XMessage msg)
        {
            if (msg == null)
            {
                return;
            }
            if (msg.StackFrameIndex > 0)
            {
                msg.MsgMethod = getMsgMethodName(msg.StackFrameIndex + 1);
            }
            else
            {
                msg.MsgMethod = getMsgMethodName(1);
            }

            if (string.IsNullOrWhiteSpace(msg.MsgTopic))
            {
                msg.MsgTopic = msg.MsgMethod;
            }
        }