Example #1
0
 internal AtLeastOnceConsumingPromise(Queue queue,
                                      IConsumedMessageBuilder builder,
                                      ConsumingConfiguration configuration,
                                      Func <ILog> logBuilder)
     : base(queue, builder, configuration, logBuilder)
 {
 }
Example #2
0
 internal AtLeastOnceConsumingPromise(Queue queue,
                                      IConsumedMessageBuilder builder,
                                      ConsumingConfiguration configuration,
                                      Func<ILog> logBuilder)
     : base(queue, builder, configuration, logBuilder)
 {
 }
Example #3
0
        public async Task NotifyFault()
        {
            var expectedException = new Exception("Unhandled exception");

            var args = new BasicDeliverEventArgs
            {
                DeliveryTag     = 1234L,
                BasicProperties = new BasicProperties()
            };

            var realConsumer = new Mock <Consumer <FakeConsumedMessage> >();
            var message      = new FakeConsumedMessage(args, _ => new Success(_, new ConsumedMessage.ConsumingResult[] { new ConsumingResultStub(_, realConsumer.Object) }));
            var builder      = new Mock <IConsumedMessageBuilder>();

            builder.Setup(_ => _.Build(It.IsAny <BasicDeliverEventArgs>())).Returns(message);

            var configuration = new ConsumingConfiguration(new Mock <IBroker>().Object, default(Queue));

            configuration.Consumes(realConsumer.Object);

            var failingInboundChannel = new FailingInboundChannel(expectedException);

            var consumer = new AtLeastOnceConsumerWrapper(failingInboundChannel, new Mock <IOutboundChannel>().Object, default(Queue), builder.Object, configuration);
            await consumer.CallConsumeInternal(args);

            realConsumer.Verify(_ => _.OnError(expectedException));
        }
Example #4
0
 internal AtMostOnceConsumerWrapper(IInboundChannel inboundChannel,
                                    IOutboundChannel outboundChannel,
                                    Queue queue,
                                    IConsumedMessageBuilder builder,
                                    ConsumingConfiguration configuration)
     : base(inboundChannel, outboundChannel, queue, builder, configuration)
 {
 }
Example #5
0
 public FakeConsumerBase(IInboundChannel inboundChannel,
                         IOutboundChannel outboundChannel,
                         Queue queue,
                         IConsumedMessageBuilder builder,
                         ConsumingConfiguration configuration)
     : base(inboundChannel, outboundChannel, queue, builder, configuration)
 {
 }
Example #6
0
 internal AtMostOnceConsumerWrapper(IInboundChannel inboundChannel,
                                    IOutboundChannel outboundChannel,
                                    Queue queue,
                                    IConsumedMessageBuilder builder,
                                    ConsumingConfiguration configuration)
     : base(inboundChannel, outboundChannel, queue, builder, configuration)
 {
 }
Example #7
0
 public FakeConsumerBase(IInboundChannel inboundChannel,
                         IOutboundChannel outboundChannel,
                         Queue queue,
                         IConsumedMessageBuilder builder,
                         ConsumingConfiguration configuration)
     : base(inboundChannel, outboundChannel, queue, builder, configuration)
 {
 }
Example #8
0
 protected internal ConsumingPromise(Queue queue,
                                     IConsumedMessageBuilder builder,
                                     ConsumingConfiguration configuration,
                                     Func<ILog> logBuilder)
 {
     Queue = queue;
     Builder = builder;
     Configuration = configuration;
     LogBuilder = logBuilder;
 }
 internal LoggedAtLeastOnceConsumer(IInboundChannel inboundChannel,
                                    IOutboundChannel outboundChannel,
                                    Queue queue,
                                    IConsumedMessageBuilder builder,
                                    ConsumingConfiguration configuration,
                                    ILog log)
     : base(inboundChannel, outboundChannel, queue, builder, configuration)
 {
     _log = log;
 }
Example #10
0
 protected internal ConsumingPromise(Queue queue,
                                     IConsumedMessageBuilder builder,
                                     ConsumingConfiguration configuration,
                                     Func <ILog> logBuilder)
 {
     Queue         = queue;
     Builder       = builder;
     Configuration = configuration;
     LogBuilder    = logBuilder;
 }
 internal LoggedAtMostOnceConsumer(IInboundChannel inboundChannel,
                                   IOutboundChannel outboundChannel,
                                   Queue queue,
                                   IConsumedMessageBuilder builder,
                                   ConsumingConfiguration configuration,
                                   ILog log)
     : base(inboundChannel, outboundChannel, queue, builder, configuration)
 {
     _log = log;
 }
Example #12
0
        private void Subscribe(Action <ConsumingConfiguration> configure,
                               Func <IConsumedMessageBuilder, ConsumingConfiguration, ConsumingPromise> func,
                               Queue queue)
        {
            var configuration = new ConsumingConfiguration(this, queue);

            configure(configuration);
            ConsumingPromise Func(IConsumedMessageBuilder _) => func(_, configuration);

            _promises.Add(Func);
        }
Example #13
0
        protected internal ConsumerBase(IInboundChannel inboundChannel,
                                        IOutboundChannel outboundChannel,
                                        Queue queue,
                                        IConsumedMessageBuilder builder,
                                        ConsumingConfiguration configuration)
        {
            InboundChannel  = inboundChannel;
            OutboundChannel = outboundChannel;
            _queue          = queue;
            _builder        = builder;
            Configuration   = configuration;

            ConsumerCancelled += OnConsumerCancelled;
        }
Example #14
0
        protected internal ConsumerBase(IInboundChannel inboundChannel,
                                        IOutboundChannel outboundChannel,
                                        Queue queue,
                                        IConsumedMessageBuilder builder,
                                        ConsumingConfiguration configuration)
        {
            InboundChannel = inboundChannel;
            OutboundChannel = outboundChannel;
            _queue = queue;
            _builder = builder;
            Configuration = configuration;

            ConsumerCancelled += OnConsumerCancelled;
        }
Example #15
0
 private static Mock<IInboundChannel> BuildInboundChannel(UInt64 deliveryTag,
                                                          Func<ConsumedMessageBase, AggregateConsumingResult> func,
                                                          ConsumingConfiguration configuration)
 {
     var args = new BasicDeliverEventArgs
                    {
                        DeliveryTag = deliveryTag,
                        BasicProperties = new BasicProperties()
                    };
     var builder = new Mock<IConsumedMessageBuilder>();
     var message = new FakeConsumedMessage(args, func);
     builder.Setup(_ => _.Build(args)).Returns(message);
     var channel = new Mock<IInboundChannel>();
     var consumer = new AtLeastOnceConsumerWrapper(channel.Object,
                                                   new Mock<IOutboundChannel>().Object,
                                                   default(Queue),
                                                   builder.Object,
                                                   configuration);
     consumer.CallConsumeInternal(args).Wait();
     return channel;
 }
Example #16
0
        private static Mock <IInboundChannel> BuildInboundChannel(UInt64 deliveryTag,
                                                                  Func <ConsumedMessageBase, AggregateConsumingResult> func,
                                                                  ConsumingConfiguration configuration)
        {
            var args = new BasicDeliverEventArgs
            {
                DeliveryTag     = deliveryTag,
                BasicProperties = new BasicProperties()
            };
            var builder = new Mock <IConsumedMessageBuilder>();
            var message = new FakeConsumedMessage(args, func);

            builder.Setup(_ => _.Build(args)).Returns(message);
            var channel  = new Mock <IInboundChannel>();
            var consumer = new AtLeastOnceConsumerWrapper(channel.Object,
                                                          new Mock <IOutboundChannel>().Object,
                                                          default(Queue),
                                                          builder.Object,
                                                          configuration);

            consumer.CallConsumeInternal(args).Wait();
            return(channel);
        }
Example #17
0
 public AtMostOnceReplying()
 {
     _configuration = new ConsumingConfiguration(new Mock <IBroker>().Object, default(Queue));
 }
Example #18
0
 private void Subscribe(Action<ConsumingConfiguration> configure,
                        Func<IConsumedMessageBuilder, ConsumingConfiguration, ConsumingPromise> func,
                        Queue queue)
 {
     var configuration = new ConsumingConfiguration(this, queue);
     configure(configuration);
     Func<IConsumedMessageBuilder, ConsumingPromise> f = _ => func(_, configuration);
     _promises.Add(f);
 }
Example #19
0
 public SubscribingConfiguration()
 {
     _configuration = new ConsumingConfiguration(new Mock <IBroker>().Object, default(Queue));
 }
 public SubscribingConfiguration()
 {
     _configuration = new ConsumingConfiguration(new Mock<IBroker>().Object, default(Queue));
 }
Example #21
0
 public AtMostOnceReplying()
 {
     _configuration = new ConsumingConfiguration(new Mock<IBroker>().Object, default(Queue));
 }
 public ApplyingFallbackStrategy()
 {
     _configuration = new ConsumingConfiguration(new Mock<IBroker>().Object, default(Queue));
 }
Example #23
0
 public ApplyingFallbackStrategy()
 {
     _configuration = new ConsumingConfiguration(new Mock <IBroker>().Object, default(Queue));
 }