Example #1
0
        public void RegisterChannel(PushChannelConfig channel)
        {
            PushReceiverBase receiver = PushHelper.CreatePushReceiver(channel, _log);

            if (receiver == null)
            {
                return;
            }

            receiver.OnMessageReceived += new PushMessageReceivedHandler(receiver_OnMessageReceived);
            _channels.Add(receiver);
        }
Example #2
0
        private void receiver_OnMessageReceived(PushReceiverBase receiver, Message message)
        {
            DumpHelper.DumpSubscriberMessage(_log, message);

            if (OnProcessing != null)
            {
                if (!OnProcessing(ref message))
                {
                    _log.Write(LogType.Warning,
                               string.Format("The processing handler rejected the subscribed message (ID: {0}) from coming in.",
                                             (message != null) ? message.Header.ID.ToString() : "(null)"));
                    return;
                }
            }

            _subscriber.ReceiveMessage(receiver.Channel, message);
        }