public static HandlerWorkerConfigurator <T> Handler <T>(this WorkerBusServiceConfigurator configurator, Action <IConsumeContext <T>, T> handler) where T : class { var handlerConfigurator = new HandlerWorkerConfiguratorImpl <T>(handler); configurator.AddConfigurator(handlerConfigurator); return(handlerConfigurator); }
static ConsumerWorkerConfigurator <TConsumer> CreateWorkerConsumerConfigurator <TConsumer>( WorkerBusServiceConfigurator configurator, IConsumerFactory <TConsumer> consumerFactory) where TConsumer : class, IConsumer { var consumerConfigurator = new ConsumerWorkerConfiguratorImpl <TConsumer>(consumerFactory); configurator.AddConfigurator(consumerConfigurator); return(consumerConfigurator); }
public static SagaWorkerConfigurator <TSaga> Saga <TSaga>( this WorkerBusServiceConfigurator configurator, ISagaRepository <TSaga> sagaRepository) where TSaga : class, ISaga { if (_log.IsDebugEnabled) { _log.DebugFormat("Subscribing Saga Worker: {0}", typeof(TSaga).ToShortTypeName()); } var sagaConfigurator = new SagaWorkerConfiguratorImpl <TSaga>(sagaRepository); configurator.AddConfigurator(sagaConfigurator); return(sagaConfigurator); }
public static ConsumerWorkerConfigurator Consumer( [NotNull] this WorkerBusServiceConfigurator configurator, [NotNull] Type consumerType, [NotNull] Func <Type, object> consumerFactory) { if (_log.IsDebugEnabled) { _log.DebugFormat("Subscribing Consumer Worker: {0} (by type, using object consumer factory)", consumerType); } object consumerConfigurator = FastActivator.Create(typeof(UntypedConsumerWorkerConfigurator <>), new[] { consumerType }, new object[] { consumerFactory }); configurator.AddConfigurator((WorkerBuilderConfigurator)consumerConfigurator); return((ConsumerWorkerConfigurator)consumerConfigurator); }