Пример #1
0
        public void SetUp()
        {
            theEnvelope = new Envelope()
            {
                Data = new byte[] { 1, 2, 3, 4 },
            };

            theSerializer = MockRepository.GenerateMock <IEnvelopeSerializer>();

            theEnvelope.Headers["A"]  = "1";
            theEnvelope.Headers["B"]  = "2";
            theEnvelope.Headers["C"]  = "3";
            theEnvelope.CorrelationId = Guid.NewGuid().ToString();

            theChannel = new RecordingChannel();

            theNode = new ChannelNode
            {
                Channel = theChannel,
                Key     = "Foo",
                Uri     = "foo://bar".ToUri()
            };

            theNode.Modifiers.Add(new HeaderSetter("D", "4"));
            theNode.Modifiers.Add(new HeaderSetter("E", "5"));

            theNode.Send(theEnvelope, theSerializer);
        }
Пример #2
0
        /*
         * Changes
         * 1.) Do serialization within sendToChannel
         * 2.) do the cloning *outside* of sendToChannel
         * 3.) Make envelopeserializer smart enough not to replace the contents if it needs to
         */

        private void sendToChannel(Envelope envelope, ChannelNode node)
        {
            var replyUri = _router.ReplyUriFor(node);

            var headers = node.Send(envelope, _serializer, replyUri: replyUri);

            _logger.InfoMessage(() => new EnvelopeSent(new EnvelopeToken
            {
                Headers = headers,
                Message = envelope.Message
            }, node));
        }