protected override void Setup(FeatureConfigurationContext context)
        {
            NonNativePubSubCheck.ThrowIfMessageDrivenPubSubInUse(context);

            var serializer = new JsonSerializer
            {
                ContractResolver = new UpperCaseIdIntoLowerCaseIdContractResolver(),
                Converters       = { new ReadOnlyMemoryConverter() }
            };

            var ttlInSeconds = context.Settings.Get <int>(SettingsKeys.OutboxTimeToLiveInSeconds);

            context.Services.AddSingleton <IOutboxStorage>(builder => new OutboxPersister(builder.GetService <ContainerHolderResolver>(), serializer, ttlInSeconds));
            context.Pipeline.Register("LogicalOutboxBehavior", builder => new OutboxBehavior(builder.GetService <ContainerHolderResolver>(), serializer), "Behavior that mimics the outbox as part of the logical stage.");
        }
Пример #2
0
        protected override void Setup(FeatureConfigurationContext context)
        {
            NonNativePubSubCheck.ThrowIfMessageDrivenPubSubInUse(context);

            var sagaConfiguration = context.Settings.GetOrDefault <SagaPersistenceConfiguration>() ?? new SagaPersistenceConfiguration();
            var pessimisticLockingConfiguration = sagaConfiguration.PessimisticLockingConfiguration;

            if (pessimisticLockingConfiguration.PessimisticLockingEnabled)
            {
                pessimisticLockingConfiguration.ValidateRefreshDelays();
            }

            var serializer = new JsonSerializer {
                ContractResolver = new UpperCaseIdIntoLowerCaseIdContractResolver()
            };

            context.Services.AddSingleton <ISagaPersister>(builder => new SagaPersister(serializer, sagaConfiguration));
        }