public void moves_to_delayed_queue()
        {
            InMemoryQueueManager.ClearAll();

            var envelope = new EnvelopeToken();
            var callback = new InMemoryCallback(null, envelope);
            callback.MoveToDelayedUntil(DateTime.Now);

            InMemoryQueueManager.DelayedEnvelopes()
                                .Single().CorrelationId.ShouldEqual(envelope.CorrelationId);
        }
Esempio n. 2
0
        public void Receive(IReceiver receiver)
        {
            while (!_disposed)
            {
                foreach (var data in _queue.GetConsumingEnumerable())
                {
                    using (var stream = new MemoryStream(data))
                    {
                        var token = _formatter.Deserialize(stream).As <EnvelopeToken>();

                        var callback = new InMemoryCallback(this, token);

                        receiver.Receive(token.Data, token.Headers, callback);
                    }
                }
            }
        }
        public void Receive(IReceiver receiver)
        {
            foreach (var data in _queue.GetConsumingEnumerable())
            {
                using (var stream = new MemoryStream(data))
                {
                    var token = _formatter.Deserialize(stream).As<EnvelopeToken>();

                    var callback = new InMemoryCallback(this, token);

                    receiver.Receive(token.Data, token.Headers, callback);
                }
            }
        }