Esempio n. 1
0
 /// <summary>
 /// Configures a fault consumer of the specified type via convention.
 /// This is for subscribing to <see cref="Fault{T}"/> events when using fire-and-forget messages.
 /// Note that send-receive messages do not publish faults.
 /// </summary>
 /// <typeparam name="TConsumer">The type of the consumer.</typeparam>
 /// <typeparam name="TMessage">The type of the message.</typeparam>
 /// <param name="builder">The builder.</param>
 /// <param name="retry">The optional retry configurator action.</param>
 /// <param name="receiveEndpointConfigurator">The optional endpoint configurator action.</param>
 /// <returns></returns>
 public static IMassTransitRabbitMqHostingBuilder ConsumeFaultByConvention <TConsumer, TMessage>(
     this IMassTransitRabbitMqHostingBuilder builder,
     Action <IRetryConfigurator> retry = null,
     Action <IRabbitMqReceiveEndpointConfigurator> receiveEndpointConfigurator = null)
     where TConsumer : class, IConsumer <Fault <TMessage> >
     where TMessage : class
 => builder.Consume <TConsumer, Fault <TMessage> >($"{builder.GetQueueName<TMessage>()}_{FaultQueuePostfix}", retry, receiveEndpointConfigurator);
 /// <summary>
 /// Configures a consumer of the specified type via convention.
 /// </summary>
 /// <typeparam name="TConsumer">The type of the consumer.</typeparam>
 /// <typeparam name="TMessage">The type of the message.</typeparam>
 /// <param name="builder">The builder.</param>
 /// <param name="retry">The optional retry configurator action.</param>
 /// <param name="receiveEndpointConfigurator">The optional endpoint configurator action.</param>
 /// <param name="consumerFactory">The optional factory for producing customers.</param>
 /// <returns></returns>
 public static IMassTransitRabbitMqHostingBuilder ConsumeByConvention <TConsumer, TMessage>(
     this IMassTransitRabbitMqHostingBuilder builder,
     Action <IRetryConfigurator> retry = null,
     Action <IRabbitMqReceiveEndpointConfigurator> receiveEndpointConfigurator = null,
     Func <IServiceProvider, TConsumer> consumerFactory = null)
     where TConsumer : class, IConsumer <TMessage>
     where TMessage : class
 => builder.Consume <TConsumer, TMessage>(builder.GetQueueName <TMessage>(), retry, receiveEndpointConfigurator, consumerFactory);
 /// <summary>
 /// Configures a consumer of the specified type via convention.
 /// </summary>
 /// <typeparam name="TConsumer">The type of the consumer.</typeparam>
 /// <typeparam name="TMessage">The type of the message.</typeparam>
 /// <param name="builder">The builder.</param>
 /// <param name="retry">The optional retry configurator action.</param>
 /// <returns></returns>
 public static IMassTransitRabbitMqHostingBuilder ConsumeByConvention <TConsumer, TMessage>(this IMassTransitRabbitMqHostingBuilder builder,
                                                                                            Action <IRetryConfigurator> retry = null)
     where TConsumer : class, IConsumer <TMessage>
     where TMessage : class
 => builder.Consume <TConsumer, TMessage>(builder.GetQueueName <TMessage>(), retry);