/// <summary>
        /// Adds all sagas in the specified assemblies matching the namespace. If you are using both state machine and regular sagas, be
        /// sure to call AddSagaStateMachinesFromNamespaceContaining prior to calling this one.
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="type">The type to use to identify the assembly and namespace to scan</param>
        /// <param name="filter"></param>
        public static void AddSagaStateMachinesFromNamespaceContaining(this IConfigurationExpressionConfigurator configurator, Type type,
                                                                       Func <Type, bool> filter = null)
        {
            var registrar = new StructureMapSagaStateMachineRegistrar(configurator.Builder);

            configurator.AddSagaStateMachinesFromNamespaceContaining(registrar, type, filter);
        }
        /// <summary>
        /// Adds a SagaStateMachine to the registry, using the factory method, and updates the registrar prior to registering so that the default
        /// saga registrar isn't notified.
        /// </summary>
        /// <param name="configurator"></param>
        /// <typeparam name="TStateMachine"></typeparam>
        /// <typeparam name="TInstance"></typeparam>
        public static void AddSagaStateMachine <TStateMachine, TInstance>(this IConfigurationExpressionConfigurator configurator)
            where TStateMachine : class, SagaStateMachine <TInstance>
            where TInstance : class, SagaStateMachineInstance
        {
            var registrar = new StructureMapSagaStateMachineRegistrar(configurator.Builder);

            configurator.AddSagaStateMachine <TStateMachine, TInstance>(registrar);
        }
Пример #3
0
        /// <summary>
        /// Decorates the IPublishEndpoint and ISendEndpointProvider with a Transaction Outbox. Messages will not be
        /// released/sent until the ambient transaction is committed. This is only meant to be used outside of a consumer.
        /// If you want an outbox for Consumers, it is recommended to use the InMemoryOutbox.
        /// </summary>
        public static void AddTransactionOutbox(this IConfigurationExpressionConfigurator builder)
        {
            builder.Builder
            .For <TransactionOutbox>()
            .Use("Fetch Bus Control and Create TransactionOutbox", x =>
            {
                var busControl = x.GetInstance <IBusControl>();

                return(new TransactionOutbox(busControl, busControl, x.TryGetInstance <ILoggerFactory>()));
            })
            .Singleton();

            builder.Builder
            .For <IPublishEndpoint>()
            .Use(x => x.GetInstance <TransactionOutbox>())
            .Singleton();

            builder.Builder
            .For <ISendEndpointProvider>()
            .Use(x => x.GetInstance <TransactionOutbox>())
            .Singleton();
        }
        /// <summary>
        /// Adds SagaStateMachines to the registry, using the factory method, and updates the registrar prior to registering so that the default
        /// saga registrar isn't notified.
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="types">The state machine types to add</param>
        public static void AddSagaStateMachines(this IConfigurationExpressionConfigurator configurator, params Type[] types)
        {
            var registrar = new StructureMapSagaStateMachineRegistrar(configurator.Builder);

            configurator.AddSagaStateMachines(registrar, types);
        }
        /// <summary>
        /// Adds all sagas in the specified assemblies matching the namespace. If you are using both state machine and regular sagas, be
        /// sure to call AddSagaStateMachinesFromNamespaceContaining prior to calling this one.
        /// </summary>
        /// <param name="configurator"></param>
        /// <typeparam name="T">The anchor type</typeparam>
        public static void AddSagaStateMachinesFromNamespaceContaining <T>(this IConfigurationExpressionConfigurator configurator)
        {
            var registrar = new StructureMapSagaStateMachineRegistrar(configurator.Builder);

            configurator.AddSagaStateMachinesFromNamespaceContaining(registrar, typeof(T));
        }