コード例 #1
0
        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);
        }