0

Nservicebus 4 の RC2 と、次の場所からダウンロードした PubSub サンプルを使用しています: http://particular.net/articles/windows-azure-transport

(サンプルに示されている azure csfg ファイルの代わりに) コード ベースの構成を実行しようとしています。これは NServiceBus の以前のバージョンで機能するため、ここで何が欠けているのかわかりません。カスタム構成が取得されていません。これはバグですか?

問題を再現する必要がある変更を次に示します。

  1. nservicebus 構成を webrole 設定から削除しました
  2. カスタム IConfigurationSource の同じ構成設定を置き換え、AzureConfigurationSource をバス ブートストラップ コードから削除しました。

Global.asax.cs ファイルの変更されたブートストラップ コードを次に示します。

  var bus = Configure.With()
                .DefaultBuilder()
                .CustomConfigurationSource(new CustomConfig())
                .MessageForwardingInCaseOfFault()
                .AzureMessageQueue()
                    .QueuePerInstance()
                .UnicastBus()
                .CreateBus()
            .Start();

CustomConfig クラスは次のとおりです。

internal class CustomConfig : IConfigurationSource
{
    public T GetConfiguration<T>() where T : class, new()
    {
        // the part you are overriding
        if (typeof(T) == typeof(AzureQueueConfig))
            return new AzureQueueConfig { ConnectionString = "storage key here", QueueName = "orderwebsiteinputqueue" } as T;

        if (typeof(T) == typeof(MessageForwardingInCaseOfFaultConfig))
            return new MessageForwardingInCaseOfFaultConfig { ErrorQueue = "errorqueue"} as T;

        if (typeof(T) == typeof(TransportConfig))
            return new TransportConfig() { MaxRetries = 5, MaximumConcurrencyLevel = 1} as T;

        // leaving the rest of the configuration as is:
        return ConfigurationManager.GetSection(typeof(T).Name) as T;
    }
}
4

1 に答える 1