public static IHostBuilder UseExactlyOnceWebMachineInterface <T>(this IHostBuilder hostBuilder,
                                                                         IApplicationStateStore <T> applicationStateContainer,
                                                                         IMachineWebInterfaceRequestStore requestStore,
                                                                         IMachineWebInterfaceResponseStore responseStore,
                                                                         IMessageStore messageStore)
        {
            hostBuilder.ConfigureServices((ctx, serviceCollection) =>
            {
                serviceCollection.AddSingleton <IMachineInterfaceConnector <T> >(serviceProvider =>
                {
                    var dispatcher         = serviceProvider.GetService <IDispatchMessages>();
                    var rootMessageSession = serviceProvider.GetService <IMessageSession>();

                    var connector = new MachineInterfaceConnector <T>(
                        applicationStateContainer,
                        new ISideEffectsHandler[0],
                        rootMessageSession,
                        dispatcher,
                        messageStore,
                        requestStore,
                        responseStore);

                    return(connector);
                });
            });


            return(hostBuilder);
        }
        public static ExactlyOnceEntitiesSettings <T> UseExactlyOnce <T>(this EndpointConfiguration config,
                                                                         IApplicationStateStore <T> applicationStateStore,
                                                                         IMessageStore messageStore)
        {
            if (!config.GetSettings().TryGet <ExactlyOnceEntitiesSettings <T> >("ExactlyOnce.Settings", out var settings))
            {
                settings = new ExactlyOnceEntitiesSettings <T>(applicationStateStore);
                config.GetSettings().Set("ExactlyOnce.Settings", settings);
            }
            settings.MessageStore = messageStore;

            config.GetSettings().EnableFeatureByDefault(typeof(ExactlyOnceFeature));
            return(settings);
        }
        public HumanInterfaceConnector(IApplicationStateStore <TPartition> applicationStateStore,
                                       IEnumerable <ISideEffectsHandler> sideEffectsHandlers,
                                       IMessageSession rootMessageSession,
                                       IDispatchMessages dispatcher,
                                       ITransactionInProgressStore transactionInProgressStore,
                                       IMessageStore messageStore)
        {
            this.applicationStateStore      = applicationStateStore;
            this.rootMessageSession         = rootMessageSession;
            this.transactionInProgressStore = transactionInProgressStore;
            this.messageStore = messageStore;

            var allHandlers = sideEffectsHandlers.Concat(new ISideEffectsHandler[]
            {
                new WebMessagingWithClaimCheckSideEffectsHandler(messageStore, dispatcher),
                new TransactionInProgressSideEffectHandler(transactionInProgressStore),
            });

            processor = new ExactlyOnceProcessor <object>(allHandlers.ToArray(), new NServiceBusDebugLogger());
        }
        public static IHostBuilder UseAtomicCommitMessageSession <T>(this IHostBuilder hostBuilder,
                                                                     IApplicationStateStore <T> applicationStateContainer,
                                                                     ITransactionInProgressStore transactionInProgressStore,
                                                                     IMessageStore messageStore)
        {
            hostBuilder.ConfigureServices((ctx, serviceCollection) =>
            {
                serviceCollection.AddSingleton <IHumanInterfaceConnector <T> >(serviceProvider =>
                {
                    var dispatcher         = serviceProvider.GetService <IDispatchMessages>();
                    var rootMessageSession = serviceProvider.GetService <IMessageSession>();

                    var connector = new HumanInterfaceConnector <T>(applicationStateContainer, new ISideEffectsHandler[0],
                                                                    rootMessageSession, dispatcher, transactionInProgressStore, messageStore);
                    return(connector);
                });
            });


            return(hostBuilder);
        }
        public MachineInterfaceConnector(IApplicationStateStore <T> applicationStateStore,
                                         IEnumerable <ISideEffectsHandler> sideEffectsHandlers,
                                         IMessageSession rootMessageSession,
                                         IDispatchMessages dispatcher,
                                         IMessageStore messageStore,
                                         IMachineWebInterfaceRequestStore requestStore,
                                         IMachineWebInterfaceResponseStore responseStore)
        {
            this.applicationStateStore = applicationStateStore;
            this.rootMessageSession    = rootMessageSession;
            this.messageStore          = messageStore;
            this.requestStore          = requestStore;
            this.responseStore         = responseStore;

            var allHandlers = sideEffectsHandlers.Concat(new ISideEffectsHandler[]
            {
                new WebMessagingWithClaimCheckSideEffectsHandler(messageStore, dispatcher),
                new HttpResponseSideEffectsHandler(requestStore, responseStore),
            });

            processor = new ExactlyOnceProcessor <object>(allHandlers.ToArray(), new NServiceBusDebugLogger());
        }
Exemplo n.º 6
0
 public CorrelatedApplicationStateStore(CorrelationManager <T> correlationManager, IApplicationStateStore <T> applicationStateStore)
 {
     this.correlationManager    = correlationManager;
     this.applicationStateStore = applicationStateStore;
 }