public void Send(byte[] data, IHeaders headers) { var envelope = new EnvelopeToken { Data = data, Headers = headers }; _queue.Enqueue(envelope); }
public void can_round_trip_an_envelope_through_the_queue() { var envelope = new EnvelopeToken(); envelope.CorrelationId = Guid.NewGuid().ToString(); envelope.Headers["Foo"] = "Bar"; envelope.Data = new byte[] { 1, 2, 3, 4, 5 }; var queue = new InMemoryQueue(new Uri("memory://foo")); var receiver = new RecordingReceiver(); var task = Task.Factory.StartNew(() => queue.Receive(receiver)); queue.Enqueue(envelope); Wait.Until(() => receiver.Received.Any(), timeoutInMilliseconds: 2000); var received = receiver.Received.Single(); received.CorrelationId.ShouldEqual(envelope.CorrelationId); received.ContentType.ShouldEqual(envelope.ContentType); received.Data.ShouldEqual(envelope.Data); task.SafeDispose(); }
public void Requeue() { _parent.Enqueue(_token); }