protected override void ConfigureInputQueueEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            _consumer = new OneMessageConsumer(GetTask<MessageA>());


            configurator.Consumer(() => _consumer);
        }
示例#2
0
        protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            configurator.ConcurrencyLimit = 10;

            configurator.Consumer(() =>
            {
                TaskCompletionSource <Batch <PingMessage> > tcs = GetTask <Batch <PingMessage> >();
                tcs.Task.ContinueWith(t => _batches.Add(t.Result));
                var consumer = new TestBatchConsumer(tcs);
                return(consumer);
            }, cc => cc.Options <BatchOptions>(x => x.SetTimeLimit(TimeSpan.FromMilliseconds(300)).GroupBy <PingMessage, Guid>(ctx => ctx.CorrelationId)));
        }
示例#3
0
        protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            base.ConfigureInMemoryReceiveEndpoint(configurator);

            _collection = Database.GetCollection <RoutingSlipDocument>(EventCollectionName);

            var persister = new RoutingSlipEventPersister(_collection);

            configurator.Consumer(() => new RoutingSlipCompletedConsumer(persister));

            _completed = Handled <RoutingSlipCompleted>(configurator, x => x.Message.TrackingNumber == _trackingNumber);
        }
示例#4
0
        protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            RetryEnumerator.MoveNext();
            var retryPolicy = RetryEnumerator.Current;

        #pragma warning disable 618
            configurator.UseRetry(r => r.SetRetryPolicy(x => retryPolicy));
        #pragma warning restore 618
            configurator.Consumer <TConsumer>(
                x =>
            {
            });
        }
        protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            base.ConfigureInMemoryReceiveEndpoint(configurator);

            _receivedA = GetTask <MessageA>();
            _receivedB = GetTask <MessageB>();

            ConsumerConvention.Remove <AsyncConsumerConvention>();
            ConsumerConvention.Remove <LegacyConsumerConvention>();
            ConsumerConvention.Remove <BatchConsumerConvention>();

            configurator.Consumer(typeof(DefaultHandlers), type => new DefaultHandlers(_receivedA, _receivedB));
        }
        protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            base.ConfigureInMemoryReceiveEndpoint(configurator);

            _receivedA = GetTask <MessageA>();
            _receivedB = GetTask <MessageB>();

            configurator.UseMessageRetry(r => r.Interval(1, 100));

            ConsumerConvention.Register <CustomConsumerConvention>();

            configurator.Consumer(typeof(CustomHandler), type => new CustomHandler(_receivedA, _receivedB));
        }
        protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            base.ConfigureInMemoryReceiveEndpoint(configurator);

            configurator.UseCircuitBreaker(x =>
            {
                x.ActiveThreshold = 5;
                x.ResetInterval   = TimeSpan.FromSeconds(15);
                x.TrackingPeriod  = TimeSpan.FromSeconds(10);
                x.TripThreshold   = 20;
            });

            configurator.Consumer(() => new BreakingConsumer());
        }
示例#8
0
        protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            base.ConfigureInMemoryReceiveEndpoint(configurator);

            _consumer = new MyConsumer();

            configurator.Consumer(() => _consumer, x =>
            {
                x.Message <TestMessage>(v => v.UseContextFilter(async context => context.Message.Key == "ACCEPT"));
            });

            _accepted = Handled <TestMessage>(configurator, x => x.Message.Key == "ACCEPT");
            _denied   = Handled <TestMessage>(configurator, x => x.Message.Key == "DENY");
        }
示例#9
0
        protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            _consumer = new MyConsumer(GetTask <PingMessage>());

            _message         = GetTask <PingMessage>();
            _consumerOnly    = GetTask <MyConsumer>();
            _consumerMessage = GetTask <Tuple <MyConsumer, PingMessage> >();

            configurator.Consumer(() => _consumer, cfg =>
            {
                cfg.UseExecute(context => _consumerOnly.TrySetResult(context.Consumer));
                cfg.Message <PingMessage>(m => m.UseExecute(context => _message.TrySetResult(context.Message)));
                cfg.ConsumerMessage <PingMessage>(m => m.UseExecute(context => _consumerMessage.TrySetResult(Tuple.Create(context.Consumer, context.Message))));
            });
        }
示例#10
0
        protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            _consumer = new FailingBatchConsumer();

            configurator.UseScheduledRedelivery(r => r.Intervals(100));
            configurator.UseMessageRetry(r => r.Immediate(1));

            configurator.Consumer(() => _consumer);

            configurator.Handler <Fault <PingMessage> >(async m =>
            {
                if (_firstId == m.Message.Message.CorrelationId)
                {
                    _firstFault.SetResult(m);
                }
                if (_secondId == m.Message.Message.CorrelationId)
                {
                    _secondFault.SetResult(m);
                }
            });
        }
        protected override void ConfigureInputQueueEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            _consumer = new OneMessageConsumer(GetTask <MessageA>());

            configurator.Consumer(typeof(OneMessageConsumer), type => _consumer);
        }
示例#12
0
        protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            base.ConfigureInMemoryReceiveEndpoint(configurator);

            configurator.Consumer <Consumer>(_container, _tag);
        }
        protected override void ConfigureInputQueueEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            base.ConfigureInputQueueEndpoint(configurator);

            _collection = Database.GetCollection<RoutingSlipDocument>(EventCollectionName);

            var persister = new RoutingSlipEventPersister(_collection);

            configurator.Consumer(() => new RoutingSlipCompletedConsumer(persister));

            _completed = Handled<RoutingSlipCompleted>(configurator, x => x.Message.TrackingNumber == _trackingNumber);
        }
示例#14
0
 protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
 {
     configurator.ConcurrencyLimit = 10;
     configurator.Consumer(() => new TestBatchConsumer(), x =>
                           x.Options <BatchOptions>(options => options.SetMessageLimit(8).SetTimeLimit(s: 5)));
 }
示例#15
0
 protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
 {
     configurator.Consumer <PingConsumer>();
 }
示例#16
0
 protected override void ConfigureInputQueueEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
 {
     configurator.Consumer <Consumer>(
         x => x.UseConsoleLog(async(context, logContext) => string.Format("{1:u} {2:F0} Consumer: {0}", TypeMetadataCache <Consumer> .ShortName,
                                                                          logContext.StartTime, logContext.Duration.TotalMilliseconds)));
 }
示例#17
0
 protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
 {
     configurator.Consumer(() => new TestJobConsumer());
 }
示例#18
0
 protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
 {
     configurator.Consumer <TestConsumer>();
     _handledA = Handled <A>(configurator);
     _handledB = Handled <B>(configurator);
 }
示例#19
0
 protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
 {
     configurator.ConcurrencyLimit = 20;
     configurator.Consumer <BadConsumer>();
 }
示例#20
0
        protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            _consumer = new TestBatchConsumer(GetTask <Batch <PingMessage> >());

            configurator.Consumer(() => _consumer);
        }
示例#21
0
 protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
 {
     configurator.Consumer(() => new TestConsumer());
     configurator.Consumer(() => new GenericConsumer <GenericMessage <LongMessage> >());
 }