コード例 #1
0
 public ConsumerMessageHandlerMiddleware(IPipeBuilderFactory pipeBuilderFactory, IPipeContextFactory contextFactory, ConsumeOptions options = null)
 {
     ContextFactory         = contextFactory;
     ConsumeFunc            = options?.ConsumerFunc ?? (context => context.GetConsumer());
     ConsumePipe            = pipeBuilderFactory.Create(options?.Pipe ?? (builder => {}));
     ThrottledExecutionFunc = options?.ThrottleFuncFunc ?? (context => context.GetConsumeThrottleAction());
 }
コード例 #2
0
 public ResponseConsumeMiddleware(IConsumerFactory consumerFactory, IPipeBuilderFactory factory, ResponseConsumerOptions options)
 {
     ResponseConfigFunc    = options?.ResponseConfigFunc ?? (context => context.GetResponseConfiguration());
     CorrelationidFunc     = options?.CorrelationIdFunc ?? (context => context.GetBasicProperties()?.CorrelationId);
     DedicatedConsumerFunc = options?.UseDedicatedConsumer ?? (context => context.GetDedicatedResponseConsumer());
     ConsumerFactory       = consumerFactory;
     ResponsePipe          = factory.Create(options.ResponseReceived);
 }
コード例 #3
0
 public ResponseConsumeMiddleware(IConsumerFactory consumerFactory, IPipeBuilderFactory factory, ILogger <ResponseConsumeMiddleware> logger, ResponseConsumerOptions options)
 {
     ResponseConfigFunc    = options?.ResponseConfigFunc ?? (context => context.GetResponseConfiguration());
     CorrelationidFunc     = options?.CorrelationIdFunc ?? (context => context.GetBasicProperties()?.CorrelationId);
     DedicatedConsumerFunc = options?.UseDedicatedConsumer ?? (context => context.GetDedicatedResponseConsumer());
     ConsumerFactory       = consumerFactory ?? throw new ArgumentNullException(nameof(consumerFactory));
     Logger       = logger ?? throw new ArgumentNullException(nameof(logger));
     ResponsePipe = factory.Create(options.ResponseReceived);
 }
コード例 #4
0
 public RespondExceptionMiddleware(IPipeBuilderFactory factory, ILogger <ExceptionHandlingMiddleware> logger, RespondExceptionOptions options = null)
     : base(factory, logger, new ExceptionHandlingOptions {
     InnerPipe = options?.InnerPipe
 })
 {
     DeliveryArgsFunc  = options?.DeliveryArgsFunc ?? (context => context.GetDeliveryEventArgs());
     ConsumeConfigFunc = options?.ConsumeConfigFunc ?? (context => context.GetConsumeConfiguration());
     SaveAction        = options?.SaveAction ?? ((context, information) => context.Properties.TryAdd(RespondKey.ResponseMessage, information));
 }
コード例 #5
0
 public ConsumerMessageHandlerMiddleware(
     IPipeBuilderFactory pipeBuilderFactory,
     IPipeContextFactory contextFactory,
     ILogger <ConsumerMessageHandlerMiddleware> logger,
     ConsumeOptions options = null)
 {
     ContextFactory         = contextFactory ?? throw new ArgumentNullException(nameof(contextFactory));
     Logger                 = logger ?? throw new ArgumentNullException(nameof(logger));
     ConsumeFunc            = options?.ConsumerFunc ?? (context => context.GetConsumer());
     ConsumePipe            = pipeBuilderFactory.Create(options?.Pipe ?? (builder => {}));
     ThrottledExecutionFunc = options?.ThrottleFuncFunc ?? (context => context.GetConsumeThrottleAction());
 }
コード例 #6
0
 public SubscriptionExceptionMiddleware(
     IPipeBuilderFactory factory,
     IChannelFactory channelFactory,
     ITopologyProvider provider,
     INamingConventions conventions,
     SubscriptionExceptionOptions options)
     : base(factory, new ExceptionHandlingOptions {
     InnerPipe = options.InnerPipe
 })
 {
     _channelFactory = channelFactory;
     _provider       = provider;
     _conventions    = conventions;
     ChannelFunc     = options?.ChannelFunc ?? ((c, f) => f.CreateChannelAsync());
 }
コード例 #7
0
 public SubscriptionExceptionMiddleware(
     IPipeBuilderFactory factory,
     IChannelFactory channelFactory,
     ITopologyProvider provider,
     INamingConventions conventions,
     ILogger <ExceptionHandlingMiddleware> logger,
     SubscriptionExceptionOptions options)
     : base(factory, logger, new ExceptionHandlingOptions {
     InnerPipe = options.InnerPipe
 })
 {
     _channelFactory = channelFactory ?? throw new ArgumentNullException(nameof(channelFactory));
     _provider       = provider ?? throw new ArgumentNullException(nameof(provider));
     _conventions    = conventions ?? throw new ArgumentNullException(nameof(conventions));
     ChannelFunc     = options?.ChannelFunc ?? ((c, f) => f.CreateChannelAsync());
 }
コード例 #8
0
 public BusClient(IPipeBuilderFactory pipeBuilderFactory, IPipeContextFactory contextFactory, IChannelFactory factory)
 {
     _pipeBuilderFactory = pipeBuilderFactory;
     _contextFactory     = contextFactory;
 }
コード例 #9
0
 public ExceptionHandlingMiddleware(IPipeBuilderFactory factory, ExceptionHandlingOptions options = null)
 {
     HandlingFunc = options?.HandlingFunc ?? ((exception, context, token) => Task.FromResult(0));
     InnerPipe    = factory.Create(options?.InnerPipe);
 }
コード例 #10
0
 public ExceptionHandlingMiddleware(IPipeBuilderFactory factory, ILogger <ExceptionHandlingMiddleware> logger, ExceptionHandlingOptions options = null)
 {
     Logger       = logger ?? throw new ArgumentNullException(nameof(logger));
     HandlingFunc = options?.HandlingFunc ?? ((exception, context, token) => Task.CompletedTask);
     InnerPipe    = (factory ?? throw new ArgumentNullException(nameof(factory))).Create(options?.InnerPipe);
 }