Exemple #1
0
        private void EnqueueDeferredMessage(IServiceBus bus, DateTime ignoreTillDate)
        {
            var command = new SimpleCommand
                {
                    Name = Guid.NewGuid().ToString()
                };

            var message = bus.CreateTransportMessage(command, c => c.Defer(ignoreTillDate)
                         .WithRecipient(bus.Configuration.Inbox.WorkQueue));

            bus.Configuration.Inbox.WorkQueue.Enqueue(message.MessageId, bus.Configuration.Serializer.Serialize(message));

            _log.Information(string.Format("[message enqueued] : name = '{0}' / deferred till date = '{1}'", command.Name, message.IgnoreTillDate));
        }