예제 #1
0
        public ConsumerFactory(InternalConsumerFactory internalConsumerFactory)
        {
            Preconditions.CheckNotNull(internalConsumerFactory, "internalConsumerFactory");

            this._internalConsumerFactory = internalConsumerFactory;

            EventBus.Instance.Subscribe <StoppedConsumingEvent>(stoppedConsumingEvent =>
            {
                object value;
                this._consumers.TryRemove(stoppedConsumingEvent.Consumer, out value);
            });
        }
예제 #2
0
        public PersistentConsumer(
            IQueue queue,
            Func <byte[], MessageProperties, MessageReceivedInfo, Task> onMessage,
            PersistentConnection connection,
            ConsumerConfiguration configuration,
            InternalConsumerFactory internalConsumerFactory)
        {
            Preconditions.CheckNotNull(queue, "queue");
            Preconditions.CheckNotNull(onMessage, "onMessage");
            Preconditions.CheckNotNull(connection, "connection");
            Preconditions.CheckNotNull(configuration, "configuration");
            Preconditions.CheckNotNull(internalConsumerFactory, "internalConsumerFactory");

            this._queue                   = queue;
            this._onMessage               = onMessage;
            this._connection              = connection;
            this._configuration           = configuration;
            this._internalConsumerFactory = internalConsumerFactory;
        }