Пример #1
0
        public IDisposable AddOutboxToBeMonitored <TMessage>(IOutbox <TMessage> outbox, Action <Envelope <TMessage> > send)
        {
            Assert.ArgumentNotNull(outbox, nameof(outbox));
            Assert.ArgumentNotNull(send, nameof(send));

            var sender = new OutboxSender <TMessage>(_messageBus.Logger, outbox, send);

            return(Monitor.AddOutboxToBeMonitored(sender));
        }
        public OutboxSubscription(IBusBase messageBus, ISubscription <TPayload> inner, IOutbox <TPayload> outbox)
        {
            Assert.ArgumentNotNull(messageBus, nameof(messageBus));
            Assert.ArgumentNotNull(inner, nameof(inner));
            Assert.ArgumentNotNull(outbox, nameof(outbox));

            _inner = inner;
            var sender      = new OutboxSender <TPayload>(messageBus.Logger, outbox, PublishInternal);
            var outboxToken = messageBus.TryAddOutboxToBeMonitored(sender);

            _outbox = new SendingOutbox <TPayload>(outbox, sender, outboxToken);
        }