public object MutateIncoming(object message)
        {
            _currentMessage = message;

            try
            {
                var pipeProxy = _pipeFactory.CreateChannel();
                if (pipeProxy == null || _pipeFactory.State != CommunicationState.Opened)
                {
                    Logger.Warn("Could not publish received message - connection closed.");
                    return message;
                }

                var json = JsonConvert.SerializeObject(message);
                var type = message.GetType().FullName;

                var contract = new MessageReceivedContract
                {
                    Endpoint = Configure.EndpointName,
                    MessageJson = json,
                    MessageType = type
                };
                Logger.Info("Published received message.");
                pipeProxy.MessageReceived(contract);
            }
            catch (EndpointNotFoundException e)
            {
                Logger.Error("Unable to publish received message.", e);
            }
            catch (CommunicationObjectFaultedException e)
            {
                Logger.Error("Unable to publish received message.", e);
            }

            return message;
        }
예제 #2
0
        public object MutateIncoming(object message)
        {
            _currentMessage = message;

            try
            {
                var pipeProxy = _pipeFactory.CreateChannel();
                if (pipeProxy == null || _pipeFactory.State != CommunicationState.Opened)
                {
                    Logger.Warn("Could not publish received message - connection closed.");
                    return(message);
                }

                var json = JsonConvert.SerializeObject(message);
                var type = message.GetType().FullName;

                var contract = new MessageReceivedContract
                {
                    Endpoint    = Configure.EndpointName,
                    MessageJson = json,
                    MessageType = type
                };
                Logger.Info("Published received message.");
                pipeProxy.MessageReceived(contract);
            }
            catch (EndpointNotFoundException e)
            {
                Logger.Error("Unable to publish received message.", e);
            }
            catch (CommunicationObjectFaultedException e)
            {
                Logger.Error("Unable to publish received message.", e);
            }

            return(message);
        }
예제 #3
0
 public void MessageReceived(MessageReceivedContract message)
 {
     MessageReceivedEvent(this, message);
 }
 public void MessageReceived(MessageReceivedContract message)
 {
     MessageReceivedEvent(this, message);
 }