Пример #1
0
        public void Apply(IServiceBusConfiguration configuration)
        {
            Guard.AgainstNull(configuration, "configuration");

            if (ServiceBusSection.Get() == null ||
                ServiceBusSection.Get().MessageRoutes == null)
            {
                return;
            }

            foreach (MessageRouteElement mapElement in ServiceBusSection.Get().MessageRoutes)
            {
                var messageRoute = new MessageRouteConfiguration(mapElement.Uri);

                foreach (SpecificationElement specificationElement in mapElement)
                {
                    messageRoute.AddSpecification(specificationElement.Name, specificationElement.Value);
                }

                if (messageRoute.Specifications.Any())
                {
                    configuration.AddMessageRoute(messageRoute);
                }
            }
        }
Пример #2
0
        public void Apply(IServiceBusConfiguration configuration)
        {
            Guard.AgainstNull(configuration, "configuration");

            if (ServiceBusSection.Get() == null
                ||
                ServiceBusSection.Get().Outbox == null
                ||
                string.IsNullOrEmpty(ServiceBusSection.Get().Outbox.WorkQueueUri))
            {
                return;
            }

            configuration.Outbox =
                new OutboxQueueConfiguration
            {
                WorkQueueUri              = ServiceBusSection.Get().Outbox.WorkQueueUri,
                ErrorQueueUri             = ServiceBusSection.Get().Outbox.ErrorQueueUri,
                MaximumFailureCount       = ServiceBusSection.Get().Outbox.MaximumFailureCount,
                DurationToIgnoreOnFailure =
                    ServiceBusSection.Get().Outbox.DurationToIgnoreOnFailure ??
                    ServiceBusConfiguration.DefaultDurationToIgnoreOnFailure,
                DurationToSleepWhenIdle =
                    ServiceBusSection.Get().Outbox.DurationToSleepWhenIdle ??
                    ServiceBusConfiguration.DefaultDurationToSleepWhenIdle,
                ThreadCount = ServiceBusSection.Get().Inbox.ThreadCount
            };
        }
Пример #3
0
        public void Apply(IServiceBusConfiguration configuration)
        {
            Guard.AgainstNull(configuration, nameof(configuration));

            var transactionScopeElement = TransactionScopeSection.Get();

            configuration.TransactionScope = transactionScopeElement != null
                ? new TransactionScopeConfiguration
            {
                Enabled        = transactionScopeElement.Enabled,
                IsolationLevel = transactionScopeElement.IsolationLevel,
                TimeoutSeconds = transactionScopeElement.TimeoutSeconds
            }
                : new TransactionScopeConfiguration();

            var section = ServiceBusSection.Get();

            if (section == null)
            {
                return;
            }

            configuration.CreateQueues             = section.CreateQueues;
            configuration.CacheIdentity            = section.CacheIdentity;
            configuration.RegisterHandlers         = section.RegisterHandlers;
            configuration.RemoveMessagesNotHandled = section.RemoveMessagesNotHandled;
            configuration.CompressionAlgorithm     = section.CompressionAlgorithm;
            configuration.EncryptionAlgorithm      = section.EncryptionAlgorithm;
        }
        public void Apply(IServiceBusConfiguration configuration)
        {
            Guard.AgainstNull(configuration, "configuration");

            if (ServiceBusSection.Get() == null)
            {
                return;
            }

            var controlInboxElement = ServiceBusSection.Get().ControlInbox;

            if (controlInboxElement == null
                ||
                string.IsNullOrEmpty(controlInboxElement.WorkQueueUri)
                ||
                string.IsNullOrEmpty(controlInboxElement.ErrorQueueUri))
            {
                return;
            }

            configuration.ControlInbox =
                new ControlInboxQueueConfiguration
            {
                WorkQueueUri              = controlInboxElement.WorkQueueUri,
                ErrorQueueUri             = controlInboxElement.ErrorQueueUri,
                ThreadCount               = controlInboxElement.ThreadCount,
                MaximumFailureCount       = controlInboxElement.MaximumFailureCount,
                DurationToIgnoreOnFailure =
                    controlInboxElement.DurationToIgnoreOnFailure ?? ServiceBusConfiguration.DefaultDurationToIgnoreOnFailure,
                DurationToSleepWhenIdle =
                    controlInboxElement.DurationToSleepWhenIdle ?? ServiceBusConfiguration.DefaultDurationToSleepWhenIdle
            };
        }
        public void Apply(IServiceBusConfiguration configuration)
        {
            if (ServiceBusSection.Get() == null ||
                ServiceBusSection.Get().UriResolver == null)
            {
                return;
            }

            foreach (UriResolverItemElement uriRepositoryItemElement in ServiceBusSection.Get().UriResolver)
            {
                configuration.AddUriMapping(Uri("ResolverUri", uriRepositoryItemElement.ResolverUri), Uri("TargetUri", uriRepositoryItemElement.TargetUri));
            }
        }
        public void Apply(IServiceBusConfiguration configuration)
        {
            if (ServiceBusSection.Get() != null &&
                ServiceBusSection.Get().QueueFactories != null)
            {
                foreach (QueueFactoryElement queueFactoryElement in ServiceBusSection.Get().QueueFactories)
                {
                    var type = Type.GetType(queueFactoryElement.Type);

                    Guard.Against <EsbConfigurationException>(type == null,
                                                              string.Format(Resources.UnknownTypeException, queueFactoryElement.Type));

                    configuration.AddQueueFactoryType(type);
                }

                configuration.ScanForQueueFactories = ServiceBusSection.Get().QueueFactories.Scan;
            }
        }
Пример #7
0
        public void Apply(IServiceBusConfiguration configuration)
        {
            Guard.AgainstNull(configuration, "configuration");

            if (ServiceBusSection.Get() == null
                ||
                ServiceBusSection.Get().Worker == null
                ||
                string.IsNullOrEmpty(ServiceBusSection.Get().Worker.DistributorControlWorkQueueUri))
            {
                return;
            }

            configuration.Worker = new WorkerConfiguration
            {
                DistributorControlInboxWorkQueueUri =
                    ServiceBusSection.Get().Worker.DistributorControlWorkQueueUri,
                ThreadAvailableNotificationIntervalSeconds = ServiceBusSection.Get().Worker.ThreadAvailableNotificationIntervalSeconds
            };
        }