Пример #1
0
        protected QueuedSubscriber(IGeneralBus bus, bool idempotent = true)
        {
            if (bus == null)
            {
                throw new ArgumentNullException(nameof(bus));
            }
            _generalBus  = bus;
            _internalBus = new CommandBus("SubscriptionBus");

            if (idempotent)
            {
                _messageQueue = new QueuedHandler(
                    new IdempotentHandler <Message>(
                        new AdHocHandler <Message>(_internalBus.Publish)
                        ),
                    "SubscriptionQueue");
            }
            else
            {
                _messageQueue = new QueuedHandler(
                    new AdHocHandler <Message>(_internalBus.Publish),
                    "SubscriptionQueue");
            }
            _messageQueue.Start();
        }
Пример #2
0
        protected QueuedSubscriber(IBus bus, bool idempotent = false)
        {
            _externalBus = bus ?? throw new ArgumentNullException(nameof(bus));
            _internalBus = new InMemoryBus("SubscriptionBus");

            if (idempotent)
            {
                _messageQueue = new QueuedHandler(
                    new IdempotentHandler <IMessage>(
                        new AdHocHandler <IMessage>(_internalBus.Publish)
                        ),
                    "SubscriptionQueue");
            }
            else
            {
                _messageQueue = new QueuedHandler(
                    new AdHocHandler <IMessage>(_internalBus.Publish),
                    "SubscriptionQueue");
            }
            _messageQueue.Start();
        }