Example #1
0
        public object MutateOutgoing(object message)
        {
            try
            {
                var pipeProxy = _pipeFactory.CreateChannel();
                if (pipeProxy == null || _pipeFactory.State != CommunicationState.Opened)
                {
                    Logger.Warn("Could not publish sent message - connection closed.");
                    return(message);
                }

                var json     = JsonConvert.SerializeObject(message);
                var contract = new MessageSentContract
                {
                    MessageJson = json,
                    MessageType = message.GetType().FullName
                };
                Logger.Info("Published sent message.");
                pipeProxy.MessageSent(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);
        }
Example #2
0
 public void MessageSent(MessageSentContract message)
 {
     MessageSentEvent(this, message);
 }
        public object MutateOutgoing(object message)
        {
            try
            {
                var pipeProxy = _pipeFactory.CreateChannel();
                if (pipeProxy == null || _pipeFactory.State != CommunicationState.Opened)
                {
                    Logger.Warn("Could not publish sent message - connection closed.");
                    return message;
                }

                var json = JsonConvert.SerializeObject(message);
                var contract = new MessageSentContract
                {
                    MessageJson = json,
                    MessageType = message.GetType().FullName
                };
                Logger.Info("Published sent message.");
                pipeProxy.MessageSent(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;
        }
 public void MessageSent(MessageSentContract message)
 {
     MessageSentEvent(this, message);
 }