コード例 #1
0
        public void send_a_message_and_get_it_back()
        {
            var envelope = new Envelope {Data = new byte[] {1, 2, 3, 4, 5}};
            envelope.Headers["foo"] = "bar";

            var receiver = new RecordingReceiver();

            node.StartReceiving(receiver, new RecordingLogger());

            node.Channel.As<LightningQueuesChannel>().Send(envelope.Data, envelope.Headers);
            Wait.Until(() => receiver.Received.Any());

            graph.Dispose();
            queues.Dispose();

            receiver.Received.Any().ShouldBeTrue();

            var actual = receiver.Received.Single();
            actual.Data.ShouldBe(envelope.Data);
            actual.Headers["foo"].ShouldBe("bar");
        }
コード例 #2
0
        public void send_a_message_and_get_it_back_non_persistent()
        {
            SetupTransport("lq.tcp://localhost:2032/upstream", ChannelMode.DeliveryFastWithoutGuarantee);

            var envelope = new Envelope { Data = new byte[] { 1, 2, 3, 4, 5 } };
            envelope.Headers["foo"] = "bar";

            var receiver = new RecordingReceiver();

            node.StartReceiving(receiver, new RecordingLogger());

            node.Channel.As<LightningQueuesChannel>().Send(envelope.Data, envelope.Headers);
            Wait.Until(() => receiver.Received.Any());

            graph.Dispose();
            queues.Dispose();

            receiver.Received.Any().ShouldBeTrue();

            var actual = receiver.Received.Single();
            actual.Data.ShouldBe(envelope.Data);
            actual.Headers["foo"].ShouldBe("bar");
        }