コード例 #1
0
        /// <summary>
        /// Limits the number of concurrent messages consumed by the consumer, regardless of message type.
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="concurrentMessageLimit">The concurrent message limit for all message types for the consumer</param>
        /// <param name="managementEndpointConfigurator">A management endpoint configurator to support runtime adjustment</param>
        /// <param name="id">An identifier for the concurrency limit to allow selective adjustment</param>
        public static void UseConcurrentMessageLimit <TConsumer>(this IConsumerConfigurator <TConsumer> configurator, int concurrentMessageLimit,
                                                                 IManagementEndpointConfigurator managementEndpointConfigurator, string id = null)
            where TConsumer : class
        {
            if (configurator == null)
            {
                throw new ArgumentNullException(nameof(configurator));
            }

            if (managementEndpointConfigurator == null)
            {
                throw new ArgumentNullException(nameof(managementEndpointConfigurator));
            }

            var observer = new ConcurrencyLimitConsumerConfigurationObserver <TConsumer>(configurator, concurrentMessageLimit, id);

            configurator.ConnectConsumerConfigurationObserver(observer);

            managementEndpointConfigurator.Instance(observer.Limiter, x =>
            {
                x.UseConcurrentMessageLimit(1);
                x.Message <SetConcurrencyLimit>(m => m.UseRetry(r => r.None()));
            });
        }
コード例 #2
0
 protected override void ConfigureConsumer(IReceiveEndpointConfigurator endpointConfigurator, IConsumerConfigurator <OrderPlacedConsumer> consumerConfigurator)
 {
     endpointConfigurator.Instance(new OrderPlacedResponseConsumer());
 }
コード例 #3
0
 public void ConsumerConfigured <TConsumer>(IConsumerConfigurator <TConsumer> configurator)
     where TConsumer : class
 {
     _consumerObservers.ConsumerConfigured(configurator);
 }
 void IConsumerConfigurationObserver.ConsumerConfigured <T>(IConsumerConfigurator <T> configurator)
 {
 }
コード例 #5
0
 protected override void ConfigureConsumer(IReceiveEndpointConfigurator endpointConfigurator, IConsumerConfigurator <DoItJobConsumer> consumerConfigurator)
 {
     consumerConfigurator.Options <JobOptions <DoIt> >(options =>
     {
         options
         .SetRetry(r =>
         {
             r.Interval(3, TimeSpan.FromSeconds(5));
         })
         .SetJobTimeout(TimeSpan.FromMinutes(10))
         .SetConcurrentJobLimit(10)
         ;
     });
 }
コード例 #6
0
 protected override void ConfigureConsumer(IReceiveEndpointConfigurator endpointConfigurator,
                                           IConsumerConfigurator <ValueConsumer> consumerConfigurator)
 {
     endpointConfigurator.UseMessageRetry(r => r.Intervals(100, 200, 500));
     endpointConfigurator.UseInMemoryOutbox();
 }
 public DelayedRedeliveryConsumerConfigurationObserver(IConsumerConfigurator <TConsumer> configurator, Action <IRetryConfigurator> configure)
 {
     _configurator = configurator;
     _configure    = configure;
 }
コード例 #8
0
 protected override void ConfigureConsumer(IReceiveEndpointConfigurator endpointConfigurator,
                                           IConsumerConfigurator <SubmitCoinCapAssetConsumer> consumerConfigurator)
 {
     endpointConfigurator.UseMessageRetry(r => r.Interval(5, 1000));
     endpointConfigurator.UseInMemoryOutbox();
 }
コード例 #9
0
 protected override void ConfigureConsumer(IReceiveEndpointConfigurator endpointConfigurator, IConsumerConfigurator <UpdateCacheConsumer> consumerConfigurator)
 {
     //TODO
 }
コード例 #10
0
 protected override void ConfigureConsumer(IReceiveEndpointConfigurator endpointConfigurator, IConsumerConfigurator <MessageConsumer> consumerConfigurator)
 {
     //((RabbitMqReceiveEndpointConfiguration)endpointConfigurator).ExchangeType = ExchangeType.Direct;
     base.ConfigureConsumer(endpointConfigurator, consumerConfigurator);
 }
コード例 #11
0
 public void ConsumerConfigured <TConsumer>(IConsumerConfigurator <TConsumer> configurator) where TConsumer : class
 {
     configurator.AddPipeSpecification(
         new FilterPipeSpecification <ConsumerConsumeContext <TConsumer> >(new LoggingFilter2 <TConsumer>()));
 }
コード例 #12
0
 protected override void ConfigureConsumer(IReceiveEndpointConfigurator endpointConfigurator, IConsumerConfigurator <SubmitOrderConsumer> consumerConfigurator)
 {
 }
コード例 #13
0
 void IConsumerDefinition <TConsumer> .Configure(IReceiveEndpointConfigurator endpointConfigurator, IConsumerConfigurator <TConsumer> consumerConfigurator)
 {
 }
コード例 #14
0
 void IConsumerConfigurationObserver.ConsumerConfigured <TConsumer>(IConsumerConfigurator <TConsumer> configurator)
 {
     _consumePipeSpecification.ConsumerConfigured(configurator);
 }
コード例 #15
0
 protected override void ConfigureConsumer(IReceiveEndpointConfigurator endpointConfigurator,
                                           IConsumerConfigurator <RoutingSlipBatchEventConsumer> consumerConfigurator)
 {
     consumerConfigurator.Options <BatchOptions>(o => o.SetMessageLimit(10).SetTimeLimit(100));
 }
コード例 #16
0
 protected override void ConfigureConsumer(IReceiveEndpointConfigurator endpointConfigurator, IConsumerConfigurator <SubmitOrderConsumer> consumerConfigurator)
 {
     // base.ConfigureConsumer(endpointConfigurator, consumerConfigurator);
     endpointConfigurator.UseMessageRetry(retry => retry.Interval(3, 1000));
     endpointConfigurator.UseExecute((context) => Console.WriteLine($"Consuming From Address: {context.SourceAddress}"));
     //consumerConfigurator.Message<SubmitOrderConsumer>(configure =>
     //{
     //   // configure.
     //});
 }
コード例 #17
0
 protected override void ConfigureConsumer(IReceiveEndpointConfigurator endpointConfigurator,
                                           IConsumerConfigurator <SubmitOrderConsumer> consumerConfigurator)
 {
     endpointConfigurator.UseMessageRetry(x => x.Intervals(10, 100, 500, 1000));
 }
コード例 #18
0
 protected override void ConfigureConsumer(IReceiveEndpointConfigurator endpointConfigurator, IConsumerConfigurator <OfferConsumer> consumerConfigurator)
 {
     endpointConfigurator.UseMessageRetry(configurator => configurator.Interval(5, 1000));
 }
コード例 #19
0
 protected override void ConfigureConsumer(IReceiveEndpointConfigurator endpointConfigurator,
                                           IConsumerConfigurator <CheckOrderStatusConsumer> consumerConfigurator)
 {
     endpointConfigurator.UseMessageRetry(r => r.Intervals(500, 1000));
 }
 protected override void ConfigureConsumer(IReceiveEndpointConfigurator endpointConfigurator,
                                           IConsumerConfigurator <CancelScheduledMessageConsumer> consumerConfigurator)
 {
     consumerConfigurator.Message <CancelScheduledMessage>(m => m.UsePartitioner(_endpointDefinition.Partition, p => p.Message.TokenId));
 }
コード例 #21
0
 protected override void ConfigureConsumer(
     IReceiveEndpointConfigurator endpointConfigurator,
     IConsumerConfigurator <UploadProvidersConsumer> consumerConfigurator)
 {
     endpointConfigurator.UseMessageRetry(r => r.Interval(3, 1000));
 }
        protected override void ConfigureConsumer(IReceiveEndpointConfigurator endpointConfigurator, IConsumerConfigurator <EnRouteToCustomerConsumer> consumerConfigurator)
        {
            consumerConfigurator.UseMessageRetry(r =>
            {
                r.SetRetryPolicy(x => x.Immediate(_settings.MessageRetryImmediatePolicy));
            });

            consumerConfigurator.UseScheduledRedelivery(r =>
            {
                r.SetRetryPolicy(x => x.Immediate(_settings.MessageRedeliveryImmediatePolicy));
            });

            consumerConfigurator.UseInMemoryOutbox();
        }
コード例 #23
0
 void IConsumerConfigurationObserver.ConsumerConfigured <TConsumer>(IConsumerConfigurator <TConsumer> configurator)
 {
     _configurator.ConsumerConfigured(configurator);
 }
コード例 #24
0
 protected override void ConfigureConsumer(IReceiveEndpointConfigurator endpointConfigurator,
                                           IConsumerConfigurator <TestBatchConsumer> consumerConfigurator)
 {
     endpointConfigurator.UseInMemoryOutbox();
     consumerConfigurator.Options <BatchOptions>(o => o.SetMessageLimit(5).SetTimeLimit(2000));
 }
コード例 #25
0
 protected override void ConfigureConsumer(
     IReceiveEndpointConfigurator endpointConfigurator,
     IConsumerConfigurator <CustomerChangedConsumer> consumerConfigurator)
 {
     consumerConfigurator.UseInMemoryOutbox();
 }
コード例 #26
0
        protected override void ConfigureConsumer(IReceiveEndpointConfigurator endpointConfigurator, IConsumerConfigurator <SubmitOrderConsumer> consumerConfigurator)
        {
            //endpointConfigurator.DiscardFaultedMessages();
            //endpointConfigurator.DiscardSkippedMessages();

            endpointConfigurator.UseMessageRetry(r => r.Interval(3, 1000));
            endpointConfigurator.UseInMemoryOutbox();
        }
コード例 #27
0
 public void ConsumerConfigured <TConsumer>(IConsumerConfigurator <TConsumer> configurator)
     where TConsumer : class
 {
     _busEndpointConfiguration.Consume.Configurator.ConsumerConfigured(configurator);
 }
 public ConcurrencyLimitConsumerConfigurationObserver(IConsumerConfigurator <TConsumer> configurator, int concurrentMessageLimit, string id = null)
 {
     _configurator = configurator;
     Limiter       = new ConcurrencyLimiter(concurrentMessageLimit, id);
 }
コード例 #29
0
 protected override void ConfigureConsumer(IReceiveEndpointConfigurator endpointConfigurator,
                                           IConsumerConfigurator <DiscoveryPingConsumer> consumerConfigurator)
 {
 }
 public void ConsumerConfigured <TConsumer>(IConsumerConfigurator <TConsumer> configurator)
     where TConsumer : class
 {
 }