void IHandleProfile.ProfileActivated()
 {
     if (!(LogManager.LoggerFactory is NullLoggerFactory))
     {
         Configure.Instance.AzureDiagnosticsLogger(false, !IsHostedIn.ChildHostProcess());
     }
 }
        protected override void InternalConfigure(Configure config)
        {
            Enable <AzureStorageQueueTransport>();
            EnableByDefault <MessageDrivenSubscriptions>();
            EnableByDefault <StorageDrivenPublisher>();
            EnableByDefault <TimeoutManager>();
            Categories.Serializers.SetDefault <JsonSerialization>();

            if (IsRoleEnvironmentAvailable())
            {
                EnableByDefault <QueueAutoCreation>();

                if (!IsHostedIn.ChildHostProcess())
                {
                    config.AzureConfigurationSource();
                }
            }



            AzureStoragePersistence.UseAsDefault();

            var configSection = NServiceBus.Configure.GetConfigSection <AzureQueueConfig>();

            if (configSection == null)
            {
                return;
            }

            SettingsHolder.SetPropertyDefault <AzureMessageQueueReceiver>(t => t.PurgeOnStartup, configSection.PurgeOnStartup);
            SettingsHolder.SetPropertyDefault <AzureMessageQueueReceiver>(t => t.MaximumWaitTimeWhenIdle, configSection.MaximumWaitTimeWhenIdle);
            SettingsHolder.SetPropertyDefault <AzureMessageQueueReceiver>(t => t.MessageInvisibleTime, configSection.MessageInvisibleTime);
            SettingsHolder.SetPropertyDefault <AzureMessageQueueReceiver>(t => t.PeekInterval, configSection.PeekInterval);
            SettingsHolder.SetPropertyDefault <AzureMessageQueueReceiver>(t => t.BatchSize, configSection.BatchSize);
        }
Beispiel #3
0
 void IHandleProfile.ProfileActivated()
 {
     Configure.Instance
     .Log4Net <AzureAppender>(
         a =>
     {
         a.InitializeDiagnostics   = !IsHostedIn.ChildHostProcess();
         a.ScheduledTransferPeriod = 10;
     });
 }
Beispiel #4
0
        /// <summary>
        /// Configures the UnicastBus with typical settings for a listener on azure
        /// </summary>
        /// <param name="specifier"></param>
        /// <returns></returns>
        public ConfigUnicastBus ConfigureRole(IConfigureThisEndpoint specifier)
        {
            var instance = Configure.Instance;

            if (RoleEnvironment.IsAvailable && !IsHostedIn.ChildHostProcess())
            {
                instance.AzureConfigurationSource();
            }

            return(instance
                   .JsonSerializer()
                   .IsTransactional(true)
                   .UnicastBus()
                   .ImpersonateSender(false));
        }
        /// <summary>
        /// Configures the UnicastBus with typical settings for a timeout manager on azure
        /// </summary>
        /// <param name="specifier"></param>
        /// <returns></returns>
        public ConfigUnicastBus ConfigureRole(IConfigureThisEndpoint specifier)
        {
            if (RoleEnvironment.IsAvailable && !IsHostedIn.ChildHostProcess())
            {
                Configure.Instance.AzureConfigurationSource();
            }

            Configure.Transactions.Enable();
            Configure.Features.Enable <Features.Sagas>();
            Configure.Serialization.Json();

            return(Configure.Instance
                   .UseAzureTimeoutPersister()
                   .UnicastBus()
                   .RunHandlersUnderIncomingPrincipal(false));
        }
        protected override void InternalConfigure(Configure config)
        {
            Categories.Serializers.SetDefault <JsonSerialization>();

            if (IsRoleEnvironmentAvailable())
            {
                EnableByDefault <QueueAutoCreation>();

                if (!IsHostedIn.ChildHostProcess())
                {
                    config.AzureConfigurationSource();
                }
            }

            var configSection = NServiceBus.Configure.GetConfigSection <AzureServiceBusQueueConfig>();

            if (configSection != null && !string.IsNullOrEmpty(configSection.QueueName))
            {
                NServiceBus.Configure.Instance.DefineEndpointName(configSection.QueuePerInstance ? QueueIndividualizer.Individualize(configSection.QueueName) : configSection.QueueName);
                Address.InitializeLocalAddress(NServiceBus.Configure.EndpointName);
            }
            else if (IsRoleEnvironmentAvailable())
            {
                NServiceBus.Configure.Instance.DefineEndpointName(RoleEnvironment.CurrentRoleInstance.Role.Name);
                Address.InitializeLocalAddress(NServiceBus.Configure.EndpointName);
            }

            var serverWaitTime = AzureServicebusDefaults.DefaultServerWaitTime;

            if (configSection != null)
            {
                serverWaitTime = configSection.ServerWaitTime;
            }

            // make sure the transaction stays open a little longer than the long poll.
            NServiceBus.Configure.Transactions.Advanced(settings => settings.DefaultTimeout(TimeSpan.FromSeconds(serverWaitTime * 1.1)).IsolationLevel(IsolationLevel.Serializable));


            Enable <AzureServiceBusTransport>();
            EnableByDefault <TimeoutManager>();
            AzureServiceBusPersistence.UseAsDefault();
        }