Exemple #1
0
 public static IRegistrationConfigurator AddTenantEventConsumers <TContext>(this IRegistrationConfigurator configurator)
     where TContext : DbContext
 {
     configurator.AddConsumer <TenantCreatedOrUpdatedConsumer <TContext> >();
     configurator.AddConsumer <TenantDeletedConsumer <TContext> >();
     return(configurator);
 }
 private static void AddConsumers(this IRegistrationConfigurator rider)
 {
     rider.AddConsumer <OrderReceivedConsumer>();
     rider.AddConsumer <CreatedProductConsumer>();
     rider.AddConsumer <UpdatedProductConsumer>();
     rider.AddConsumer <DeletedProductConsumer>();
     rider.AddConsumer <OrderRollbackConsumer>();
 }
Exemple #3
0
        protected void ConfigureRegistration <T>(IRegistrationConfigurator <T> configurator)
        {
            configurator.AddConsumer <InitialConsumer>();
            configurator.AddConsumer <SubsequentConsumer>();

            configurator.AddRequestClient <InitialRequest>();
            configurator.AddRequestClient <SubsequentRequest>();
            configurator.AddMediator();
        }
Exemple #4
0
        protected void ConfigureRegistration <T>(IRegistrationConfigurator <T> configurator)
        {
            configurator.AddConsumer <ConsumerA>(typeof(ConsumerADefinition))
            .Endpoint(x => x.Name = "shared");

            configurator.AddConsumer <ConsumerB>(typeof(ConsumerBDefinition))
            .Endpoint(x => x.Name = "shared");

            configurator.AddConsumer <ConsumerC>(typeof(ConsumerCDefinition));

            configurator.AddBus(provider => BusControl);
        }
 /// <summary>
 /// Adds the consumer, allowing configuration when it is configured on an endpoint
 /// </summary>
 /// <param name="configurator"></param>
 /// <param name="configure"></param>
 /// <typeparam name="T">The consumer type</typeparam>
 /// <typeparam name="TDefinition">The consumer definition type</typeparam>
 public static IConsumerRegistrationConfigurator <T> AddConsumer <T, TDefinition>(this IRegistrationConfigurator configurator,
                                                                                  Action <IConsumerConfigurator <T> > configure = null)
     where T : class, IConsumer
     where TDefinition : class, IConsumerDefinition <T>
 {
     return(configurator.AddConsumer(typeof(TDefinition), configure));
 }
 public static IConsumerRegistrationConfigurator <WorkflowConsumer <TMessage> > AddWorkflowConsumer <TMessage>(
     this IRegistrationConfigurator configurator,
     Action <IConsumerConfigurator <WorkflowConsumer <TMessage> > > configure = null)
     where TMessage : class
 {
     return(configurator.AddConsumer(configure));
 }
        protected void ConfigureRegistration <T>(IRegistrationConfigurator <T> configurator)
            where T : class
        {
            configurator.AddConsumer <SimplerConsumer>();

            configurator.AddMediator();
        }
Exemple #8
0
        protected void ConfigureRegistration <T>(IRegistrationConfigurator <T> configurator)
        {
            configurator.AddConsumer <OrderConsumer>();
            configurator.AddSaga <OrderSaga>()
            .InMemoryRepository();

            configurator.AddMediator();
        }
        /// <summary>
        /// Adds a combined consumer/future, where the future handles the requests and the consumer is only known to the future.
        /// This is a shortcut method,
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="configure"></param>
        /// <typeparam name="TFuture">The consumer type</typeparam>
        /// <typeparam name="TConsumer"></typeparam>
        /// <typeparam name="TRequest"></typeparam>
        /// <typeparam name="TResponse"></typeparam>
        public static IFutureRegistrationConfigurator <TFuture> AddFutureRequestConsumer <TFuture, TConsumer, TRequest, TResponse>(
            this IRegistrationConfigurator configurator, Action <IConsumerConfigurator <TConsumer> > configure = null)
            where TFuture : Future <TRequest, TResponse>
            where TRequest : class
            where TResponse : class
            where TConsumer : class, IConsumer <TRequest>
        {
            configurator.AddConsumer <TConsumer, FutureRequestConsumerDefinition <TConsumer, TRequest> >(configure);

            return(configurator.AddFuture <TFuture, RequestConsumerFutureDefinition <TFuture, TConsumer, TRequest, TResponse> >());
        }
Exemple #10
0
 protected static void ConfigureTwo <T>(IRegistrationConfigurator <IBusTwo, T> configurator)
     where T : class
 {
     configurator.AddConsumer <Consumer2>();
     configurator.AddBus(context => MassTransit.Bus.Factory.CreateUsingInMemory(cfg =>
     {
         cfg.Host(new Uri("loopback://bus-two/"));
         cfg.ConfigureEndpoints(context);
         cfg.UseHealthCheck(context);
     }));
 }
        /// <summary>
        /// Adds the specified consumer types
        /// </summary>
        /// <param name="configurator"></param>ˆ
        /// <param name="types">The state machine types to add</param>
        public static void AddConsumers(this IRegistrationConfigurator configurator, params Type[] types)
        {
            IEnumerable <Type> consumerTypes           = types.Where(TypeMetadataCache.HasConsumerInterfaces);
            IEnumerable <Type> consumerDefinitionTypes = types.Where(x => x.HasInterface(typeof(IConsumerDefinition <>)));

            var consumers = from c in consumerTypes
                            join d in consumerDefinitionTypes on c equals d.GetClosingArgument(typeof(IConsumerDefinition <>)) into dc
                            from d in dc.DefaultIfEmpty()
                            select new { ConsumerType = c, DefinitionType = d };

            foreach (var consumer in consumers)
            {
                configurator.AddConsumer(consumer.ConsumerType, consumer.DefinitionType);
            }
        }
Exemple #12
0
 protected void ConfigureRegistration <T>(IRegistrationConfigurator <T> configurator)
     where T : class
 {
     configurator.AddConsumer <DependentConsumer>();
     configurator.AddBus(provider => BusControl);
 }
 protected static void ConfigureRegistration(IRegistrationConfigurator configurator)
 {
     configurator.AddConsumer <RequestConsumer>();
     configurator.AddRequestClient <Request>();
 }
 static void AddConsumer(this IRegistrationConfigurator rider)
 {
     rider.AddConsumer <StockConfirmationConsumer>();
     rider.AddConsumer <StockConfirmationFailConsumer>();
     rider.AddConsumer <BuyerCreatedConsumer>();
 }
Exemple #15
0
 static void AddConsumers(this IRegistrationConfigurator rider)
 {
     rider.AddConsumer <OrderReceivedConsumer>();
     rider.AddConsumer <StockUpdateConsumer>();
 }