Exemple #1
0
        public IDisposable StartConsuming()
        {
            internalConsumer = internalConsumerFactory.CreateConsumer();

            internalConsumer.Cancelled += consumer => Dispose();

            var status = internalConsumer.StartConsuming(
                connection,
                queue,
                onMessage,
                configuration
                );

            if (status == StartConsumingStatus.Succeed)
            {
                eventBus.Publish(new StartConsumingSucceededEvent(this, queue));
            }
            else
            {
                eventBus.Publish(new StartConsumingFailedEvent(this, queue));
            }

            consumerCancellation = new ConsumerCancellation(Dispose);
            return(consumerCancellation);
        }
Exemple #2
0
        public IDisposable StartConsuming()
        {
            subscriptions.Add(eventBus.Subscribe <ConnectionCreatedEvent>(e => ConnectionOnConnected()));
            subscriptions.Add(eventBus.Subscribe <ConnectionDisconnectedEvent>(e => ConnectionOnDisconnected()));

            StartConsumingInternal();

            consumerCancellation = new ConsumerCancellation(Dispose);
            return(consumerCancellation);
        }
Exemple #3
0
        public IDisposable StartConsuming()
        {
            disposables.Add(eventBus.Subscribe <ConnectionCreatedEvent>(e => ConnectionOnConnected()));
            disposables.Add(eventBus.Subscribe <ConnectionDisconnectedEvent>(e => ConnectionOnDisconnected()));
            disposables.Add(Timers.Start(s => StartConsumingInternal(), RestartConsumingPeriod, RestartConsumingPeriod));

            StartConsumingInternal();

            consumerCancellation = new ConsumerCancellation(Dispose);
            return(consumerCancellation);
        }