public static SubscriptionConfiguration Configuration() { var section = ConfigurationSectionProvider.Open <SubscriptionSection>("shuttle", "subscription"); var configuration = new SubscriptionConfiguration(); var connectionStringName = "Subscription"; if (section != null) { connectionStringName = section.ConnectionStringName; configuration.Subscribe = section.Subscribe; } var settings = ConfigurationManager.ConnectionStrings[connectionStringName]; if (settings == null) { throw new InvalidOperationException(string.Format(Resources.ConnectionStringMissing, connectionStringName)); } configuration.ProviderName = settings.ProviderName; configuration.ConnectionString = settings.ConnectionString; return(configuration); }
public static ISentinelConfiguration Configuration() { var section = ConfigurationSectionProvider.Open <SentinelSection>("shuttle", "sentinel") ?? new SentinelSection(); var result = new SentinelConfiguration(); try { result.SerializerType = Type.GetType(section.SerializerType, true, true); } catch (Exception ex) { throw new ConfigurationErrorsException(string.Format(Resources.TypeNotFoundException, "SerializerType", section.SerializerType, ex.Message)); } var connectionString = ConfigurationManager.ConnectionStrings[section.ConnectionStringName]; if (connectionString == null) { throw new ConfigurationErrorsException(string.Format(Core.Data.Resources.ConnectionStringMissing, section.ConnectionStringName)); } result.ProviderName = connectionString.ProviderName; result.ConnectionString = connectionString.ConnectionString; return(result); }
internal void Initialize(IServiceBus bus) { var section = ConfigurationSectionProvider.Open <MessageForwardingSection>("shuttle", "messageForwarding"); if (section == null || section.ForwardingRoutes == null) { return; } var factory = new MessageRouteSpecificationFactory(); foreach (MessageRouteElement mapElement in section.ForwardingRoutes) { var map = _messageRoutes.Find(mapElement.Uri); if (map == null) { map = new MessageRoute(bus.Configuration.QueueManager.GetQueue(mapElement.Uri)); _messageRoutes.Add(map); } foreach (SpecificationElement specificationElement in mapElement) { map.AddSpecification(factory.Create(specificationElement.Name, specificationElement.Value)); } } }
public static ProjectionConfiguration Configuration(IConnectionConfigurationProvider provider) { Guard.AgainstNull(provider, nameof(provider)); var section = ConfigurationSectionProvider.Open <ProjectionSection>("shuttle", "projection"); var configuration = new ProjectionConfiguration(); var eventStoreConnectionStringName = "EventStore"; var eventProjectionConnectionStringName = "EventStore"; if (section != null) { eventStoreConnectionStringName = section.EventStoreConnectionStringName; eventProjectionConnectionStringName = section.EventProjectionConnectionStringName; } var connectionConfiguration = provider.Get(eventStoreConnectionStringName); configuration.EventStoreConnectionString = connectionConfiguration.ConnectionString; configuration.EventStoreProviderName = connectionConfiguration.ProviderName; connectionConfiguration = provider.Get(eventProjectionConnectionStringName); configuration.EventProjectionConnectionString = connectionConfiguration.ConnectionString; configuration.EventProjectionProviderName = connectionConfiguration.ProviderName; return(configuration); }
public static ProjectionConfiguration Configuration() { var section = ConfigurationSectionProvider.Open <ProjectionSection>("shuttle", "projection"); var configuration = new ProjectionConfiguration(); var eventStoreConnectionStringName = "EventStore"; var eventProjectionConnectionStringName = "EventStore"; if (section != null) { eventStoreConnectionStringName = section.EventStoreConnectionStringName; eventProjectionConnectionStringName = section.EventProjectionConnectionStringName; configuration.EventProjectionPrefetchCount = section.EventProjectionPrefetchCount; } var settings = GetConnectionStringSettings(eventStoreConnectionStringName); configuration.EventStoreConnectionString = settings.ConnectionString; configuration.EventStoreProviderName = settings.ProviderName; settings = GetConnectionStringSettings(eventProjectionConnectionStringName); configuration.EventProjectionConnectionString = settings.ConnectionString; configuration.EventProjectionProviderName = settings.ProviderName; return(configuration); }
public static ISentinelConfiguration Configuration() { var section = ConfigurationSectionProvider.Open <SentinelSection>("shuttle", "sentinel") ?? new SentinelSection(); if (section == null) { throw new InvalidOperationException(Resources.MissingConfigurationSectionException); } var result = new SentinelConfiguration { HeartbeatRecoveryDuration = section.HeartbeatRecoveryDuration }; try { result.SerializerType = Type.GetType(section.SerializerType, true, true); } catch (Exception ex) { throw new ConfigurationErrorsException(string.Format(Resources.TypeNotFoundException, "SerializerType", section.SerializerType, ex.Message)); } return(result); }
public static IComponentResolverConfiguration GetConfiguration() { var result = new ComponentResolverConfiguration(); var section = ConfigurationSectionProvider.Open <ComponentResolverSection>("shuttle", "componentResolver"); if (section == null) { return(result); } foreach (ComponentResolverElement component in section.Components) { var dependencyType = Type.GetType(component.DependencyType); if (dependencyType == null) { throw new ConfigurationErrorsException( string.Format(Container.Resources.MissingTypeException, component.DependencyType)); } result.AddComponent(new ComponentResolverConfiguration.Component(dependencyType)); } return(result); }
public static IMessageForwardingConfiguration Configuration() { var section = ConfigurationSectionProvider.Open <MessageForwardingSection>("shuttle", "messageForwarding"); var configuration = new MessageForwardingConfiguration(); if (section?.ForwardingRoutes == null) { return(configuration); } var factory = new MessageRouteSpecificationFactory(); foreach (MessageRouteElement mapElement in section.ForwardingRoutes) { var map = configuration.MessageRoutes.Find(mapElement.Uri); if (map == null) { map = new MessageRoute(new Uri(mapElement.Uri)); configuration.MessageRoutes.Add(map); } foreach (SpecificationElement specificationElement in mapElement) { map.AddSpecification(factory.Create(specificationElement.Name, specificationElement.Value)); } } return(configuration); }
public static IServiceConfiguration Configuration() { var section = ConfigurationSectionProvider.Open <ServiceHostSection>("shuttle", "service"); var configuration = new ServiceConfiguration(); if (section != null) { configuration.WithServiceName(section.ServiceName); if (!string.IsNullOrEmpty(section.Instance)) { configuration.WithInstance(section.Instance); } if (!string.IsNullOrEmpty(section.Username)) { configuration.WithUsername(section.Username); } if (!string.IsNullOrEmpty(section.Password)) { configuration.WithPassword(section.Password); } configuration.WithStartMode(section.StartMode); if (section.DelayedAutoStart) { configuration.WithDelayedAutoStart(); } } return(configuration); }
public static IBootstrapConfiguration Configuration() { var result = new BootstrapConfiguration(); var section = ConfigurationSectionProvider.Open <BootstrapSection>("shuttle", "bootstrap"); var reflectionService = new ReflectionService(); if (section != null) { result.Scan = section.Scan; foreach (BootstrapAssemblyElement assemblyElement in section.Assemblies) { var assembly = reflectionService.FindAssemblyNamed(assemblyElement.Name); if (assembly == null) { throw new ConfigurationErrorsException( string.Format(Resources.AssemblyNameNotFound, assemblyElement.Name)); } result.AddAssembly(assembly); } } if (result.Scan != BootstrapScan.None) { foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { result.AddAssembly(assembly); } } switch (result.Scan) { case BootstrapScan.All: { foreach (var assembly in reflectionService.GetAssemblies()) { result.AddAssembly(assembly); } break; } case BootstrapScan.Shuttle: { foreach (var assembly in reflectionService.GetMatchingAssemblies("^Shuttle\\.")) { result.AddAssembly(assembly); } break; } } return(result); }
public static ISentinelConfiguration Configuration() { var section = ConfigurationSectionProvider.Open <SentinelSection>("shuttle", "sentinel"); var configuration = new SentinelConfiguration(); if (section != null) { configuration.HeartbeatIntervalDuration = section.HeartbeatIntervalDuration; } return(configuration); }
public static IActiveTimeRangeConfiguration Configuration() { var section = ConfigurationSectionProvider.Open <ActiveTimeRangeSection>("shuttle", "activeTimeRange"); var configuration = new ActiveTimeRangeConfiguration(); if (section != null) { configuration.ActiveFromTime = section.From; configuration.ActiveToTime = section.To; } return(configuration); }
public static MsmqConfiguration Configuration() { var section = ConfigurationSectionProvider.Open <MsmqSection>("shuttle", "msmq"); var configuration = new MsmqConfiguration(); if (section != null) { configuration.LocalQueueTimeoutMilliseconds = section.LocalQueueTimeoutMilliseconds; configuration.RemoteQueueTimeoutMilliseconds = section.RemoteQueueTimeoutMilliseconds; } return(configuration); }
public static INetMQConfiguration GetConfiguration() { var section = ConfigurationSectionProvider.Open <NetMQSection>("shuttle", "netmq"); var result = new NetMQConfiguration(); if (section != null) { result.RequestTimeout = section.RequestTimeout; } return(result); }
public static ICorruptTransportMessageConfiguration Configuration() { var section = ConfigurationSectionProvider.Open <CorruptTransportMessageSection>("shuttle", "corruptTransportMessage"); var configuration = new CorruptTransportMessageConfiguration(); if (section != null) { configuration.CorruptTransportMessageFolder = section.Folder; } return(configuration); }
public static AzureESBConfiguration Configuration() { var section = ConfigurationSectionProvider.Open <AzureESBSection>("shuttle", "azureesb"); var configuration = new AzureESBConfiguration(); if (section != null) { configuration.OperationRetryCount = section.OperationRetryCount; configuration.TransportType = section.TransportType; configuration.SharedAccessKeyName = section.SharedAccessKeyName; } return(configuration); }
public static EventStoreSection Get() { lock (Padlock) { if (!_initialized) { _section = ConfigurationSectionProvider.Open <EventStoreSection>("shuttle", "eventStore"); _initialized = true; } return(_section); } }
public static TransactionScopeSection Get() { lock (Padlock) { if (!_initialized) { _section = ConfigurationSectionProvider.Open <TransactionScopeSection>("shuttle", "transactionScope"); _initialized = true; } return(_section); } }
public static ServiceBusSection Get() { lock (Padlock) { if (!_initialized) { _section = ConfigurationSectionProvider.Open <ServiceBusSection>("shuttle", "serviceBus"); _initialized = true; } return(_section); } }
public static IdempotenceConfiguration Configuration() { var section = ConfigurationSectionProvider.Open <IdempotenceSection>("shuttle", "idempotence"); var configuration = new IdempotenceConfiguration(); var connectionStringName = "Idempotence"; if (section != null) { connectionStringName = section.ConnectionStringName; } configuration.ProviderName = GetSettings(connectionStringName).ProviderName; configuration.ConnectionString = GetSettings(connectionStringName).ConnectionString; return(configuration); }
public static RabbitMQConfiguration Configuration() { var section = ConfigurationSectionProvider.Open <RabbitMQSection>("shuttle", "rabbitmq"); var configuration = new RabbitMQConfiguration(); if (section != null) { configuration.RequestedHeartbeat = section.RequestedHeartbeat; configuration.LocalQueueTimeoutMilliseconds = section.LocalQueueTimeoutMilliseconds; configuration.RemoteQueueTimeoutMilliseconds = section.RemoteQueueTimeoutMilliseconds; configuration.ConnectionCloseTimeoutMilliseconds = section.ConnectionCloseTimeoutMilliseconds; configuration.OperationRetryCount = section.OperationRetryCount; configuration.DefaultPrefetchCount = section.DefaultPrefetchCount; } return(configuration); }
public static AccessConfiguration Configuration() { var section = ConfigurationSectionProvider.Open <AccessSection>("shuttle", "access"); var configuration = new AccessConfiguration(); var connectionStringName = "Access"; if (section != null) { connectionStringName = section.ConnectionStringName; } configuration.ProviderName = GetSettings(connectionStringName).ProviderName; configuration.ConnectionString = GetSettings(connectionStringName).ConnectionString; return(configuration); }
public static SubscriptionConfiguration Configuration() { var section = ConfigurationSectionProvider.Open <SubscriptionSection>("shuttle", "subscription"); var configuration = new SubscriptionConfiguration(); var connectionStringName = "Subscription"; if (section != null) { connectionStringName = section.ConnectionStringName; configuration.Subscribe = section.Subscribe; } configuration.ProviderName = GetSettings(connectionStringName).ProviderName; configuration.ConnectionString = GetSettings(connectionStringName).ConnectionString; return(configuration); }
public DefaultAmazonSqsConfiguration GetConfiguration() { var section = ConfigurationSectionProvider.Open <AmazonSqsSection>("shuttle", "amazonSqs"); var configuration = new DefaultAmazonSqsConfiguration(); if (section != null) { foreach (EndpointElement endpoint in section.Endpoints) { configuration.AddConfiguration(endpoint.Name, new AmazonSQSConfig { ServiceURL = endpoint.ServiceUrl }); } } return(configuration); }
public static IOpswatConfiguration Configuration() { var section = ConfigurationSectionProvider.Open <OpswatSection>("shuttle", "opswat"); if (section == null) { throw new ConfigurationErrorsException("Could not find an 'opswat' configuration section."); } var result = new OpswatConfiguration(section.ApiUrl, section.ApiKey, section.SandboxFileExtensions); if (section.SampleSharingAllowed) { result.AllowSampleSharing(); } return(result); }
public static ITripleDesConfiguration Configuration() { var section = ConfigurationSectionProvider.Open <TripleDesSection>("shuttle", "tripleDes"); if (section == null) { throw new ConfigurationErrorsException(Resources.TripleDesSectionMissing); } if (string.IsNullOrEmpty(section.Key)) { throw new ConfigurationErrorsException(Resources.TripleDesKeyMissing); } return(new TripleDesConfiguration { Key = section.Key }); }
public static INetMQServerConfiguration GetConfiguration() { var section = ConfigurationSectionProvider.Open <NetMQServerSection>("shuttle", "netmq"); if (section == null) { throw new ConfigurationErrorsException(Resources.ConfigurationSectionMissing); } var result = new NetMQServerConfiguration { Port = section.Port, SerializerType = section.SerializerType }; if (section.Queues.Count < 1) { throw new ConfigurationErrorsException(Resources.QueuesEmpty); } foreach (QueueElement queueElement in section.Queues) { result.AddQueue(new QueueConfiguration(queueElement.Name, queueElement.Uri)); } if (section.QueueFactories != null) { foreach (QueueFactoryElement queueFactoryElement in section.QueueFactories) { var type = Type.GetType(queueFactoryElement.Type); Guard.Against <ConfigurationErrorsException>(type == null, string.Format(Esb.Resources.UnknownTypeException, queueFactoryElement.Type)); result.AddQueueFactoryType(type); } result.ScanForQueueFactories = section.QueueFactories.Scan; } return(result); }
public static SqlServerConfiguration Configuration() { var section = ConfigurationSectionProvider.Open <SqlServerSection>("shuttle", "sqlServer"); var configuration = new SqlServerConfiguration(); var subscriptionManagerConnectionStringName = "Subscription"; var idempotenceServiceConnectionStringName = "Idempotence"; if (section != null) { subscriptionManagerConnectionStringName = section.SubscriptionManagerConnectionStringName; idempotenceServiceConnectionStringName = section.IdempotenceServiceConnectionStringName; configuration.ScriptFolder = section.ScriptFolder; } configuration.SubscriptionManagerConnectionString = GetConnectionString(subscriptionManagerConnectionStringName); configuration.IdempotenceServiceConnectionString = GetConnectionString(idempotenceServiceConnectionStringName); return(configuration); }
public void Execute(OnAfterConfigureQueueManager pipelineEvent) { var section = ConfigurationSectionProvider.Open <PurgeQueuesSection>("shuttle", "purgeQueues"); if (section?.Queues == null) { return; } foreach (PurgeQueueElement queueElement in section.Queues) { var queue = _queueManager.GetQueue(queueElement.Uri); var purge = queue as IPurgeQueue; if (purge == null) { _log.Warning(string.Format(Resources.IPurgeQueueNotImplemented, queue.GetType().FullName)); continue; } purge.Purge(); } }
public void Execute(OnAfterInitializeQueueFactories pipelineEvent) { var section = ConfigurationSectionProvider.Open <PurgeQueuesSection>("shuttle", "purgeQueues"); if (section == null || section.Queues == null) { return; } foreach (PurgeQueueElement queueElement in section.Queues) { var queue = pipelineEvent.Pipeline.State.GetServiceBus().Configuration.QueueManager.GetQueue(queueElement.Uri); var purge = queue as IPurgeQueue; if (purge == null) { _log.Warning(string.Format(EsbModuleResources.IPurgeQueueNotImplemented, queue.GetType().FullName)); continue; } purge.Purge(); } }