static void ValidateSagaAndOutboxUseSamePersistence(List <EnabledPersistence> enabledPersistences, SettingsHolder settings)
        {
            var sagaPersisterType   = enabledPersistences.FirstOrDefault(p => p.SelectedStorages.Contains(typeof(StorageType.Sagas)));
            var outboxPersisterType = enabledPersistences.FirstOrDefault(p => p.SelectedStorages.Contains(typeof(StorageType.Outbox)));
            var bothFeaturesEnabled = settings.IsFeatureEnabled(typeof(Features.Sagas)) && settings.IsFeatureEnabled(typeof(Features.Outbox));

            if (sagaPersisterType != null &&
                outboxPersisterType != null &&
                sagaPersisterType.DefinitionType != outboxPersisterType.DefinitionType &&
                bothFeaturesEnabled)
            {
                throw new Exception($"Sagas and the Outbox need to use the same type of persistence. Saga persistence is configured to use {sagaPersisterType.DefinitionType.Name}. Outbox persistence is configured to use {outboxPersisterType.DefinitionType.Name}.");
            }
        }
Example #2
0
        internal AzureStorageQueueInfrastructure(SettingsHolder settings, string connectionString)
        {
            this.settings         = settings;
            this.connectionString = connectionString;

            settings.SetDefault(WellKnownConfigurationKeys.DelayedDelivery.EnableTimeoutManager, true);

            if (!settings.IsFeatureEnabled(typeof(TimeoutManager)) || settings.GetOrDefault <bool>("Endpoint.SendOnly"))
            {
                // TimeoutManager is already not used. Indicate to Native Delayed Delivery that we're not in the hybrid mode.
                settings.Set(WellKnownConfigurationKeys.DelayedDelivery.EnableTimeoutManager, false);
            }

            delayedDelivery  = new NativeDelayDelivery(connectionString, GetDelayedDeliveryTableName(settings), settings.GetOrDefault <bool>(WellKnownConfigurationKeys.DelayedDelivery.DisableDelayedDelivery));
            addressGenerator = new QueueAddressGenerator(settings.GetOrDefault <Func <string, string> >(WellKnownConfigurationKeys.QueueSanitizer));
        }