Пример #1
0
        static ExactlyOnceConfiguration RegisterServices(this IServiceCollection services)
        {
            var outboxConfiguration = new OutboxConfiguration();
            var configuration       = new ExactlyOnceConfiguration(outboxConfiguration);

            services.AddLogging();

            services.AddSingleton <IOnceExecutor>(sp =>
            {
                var stateStore = (IStateStore)sp.GetRequiredService(configuration.StateStoreType);
                var client     = sp.GetRequiredService <CosmosClient>();

                var outboxStore  = new OutboxStore(client, outboxConfiguration);
                var processor    = new ExactlyOnceProcessor(outboxStore, stateStore);
                var onceExecutor = new OnceExecutor(processor);

                return(onceExecutor);
            });

            return(configuration);
        }
Пример #2
0
 public StateSelector(string requestId, ExactlyOnceProcessor exactlyOnceProcessor)
 {
     this.requestId            = requestId;
     this.exactlyOnceProcessor = exactlyOnceProcessor;
 }
Пример #3
0
 public OnceExecutor(ExactlyOnceProcessor exactlyOnceProcessor)
 {
     this.exactlyOnceProcessor = exactlyOnceProcessor;
 }
Пример #4
0
 public OutputInvoker(string requestId, string stateId, ExactlyOnceProcessor processor)
 {
     this.requestId = requestId;
     this.stateId   = stateId;
     this.processor = processor;
 }
 public OnceExecutorFactory(ExactlyOnceProcessor processor)
 {
     this.processor = processor;
 }
 public OnceExecutor(ExactlyOnceProcessor processor, string requestId, string stateId)
 {
     this.processor = processor;
     this.requestId = requestId;
     this.stateId   = stateId;
 }