public T GetConfiguration <T>() where T : class, new() { // the part you are overriding //if (typeof(T) == typeof(UnicastBusConfig)) //{ // //var config = new UnicastBusConfig(); // //var coll = config.MessageEndpointMappings; // //coll.Add(new MessageEndpointMapping // //{ // // Endpoint = "ProviderDomain", // // Messages = "DDD.Provider.Messages", // //}); // //coll.Add(new MessageEndpointMapping // //{ // // Endpoint = "ProviderDomain", // // Messages = "DDD.Provider.Domain", // //}); // return config as T; //} //else if (typeof(T) == typeof(MessageForwardingInCaseOfFaultConfig)) { var errorQUeue = new MessageForwardingInCaseOfFaultConfig { ErrorQueue = "ProviderServiceErrorQueue" }; return(errorQUeue as T); } // leaving the rest of the configuration as is: return(ConfigurationManager.GetSection(typeof(T).Name) as T); }
static void DetectObsoleteConfiguration(MessageForwardingInCaseOfFaultConfig faultConfig) { if (faultConfig != null) { Logger.Error("Usage of the 'NServiceBus.Config.MessageForwardingInCaseOfFaultConfig' configuration section is discouraged and will be removed with the next major version. Use the 'endpointConfiguration.SendFailedMessagesTo()' code configuration API instead."); } }
public T GetConfiguration <T>() where T : class, new() { if (typeof(T) == typeof(MessageForwardingInCaseOfFaultConfig)) { var errorConfig = new MessageForwardingInCaseOfFaultConfig { ErrorQueue = "error" }; return(errorConfig as T); } // To in app.config for other sections not defined in this method, otherwise return null. return(ConfigurationManager.GetSection(typeof(T).Name) as T); }
public T GetConfiguration <T>() where T : class, new() { if (typeof(T) == typeof(MessageForwardingInCaseOfFaultConfig)) { var config = new MessageForwardingInCaseOfFaultConfig { ErrorQueue = "error@machinename" }; return(config as T); } // Respect app.config for other sections not defined in this method return(System.Configuration.ConfigurationManager.GetSection(typeof(T).Name) as T); }
public T GetConfiguration <T>() where T : class, new() { // the part you are overriding if (typeof(T) == typeof(UnicastBusConfig)) { var config = new UnicastBusConfig(); var coll = config.MessageEndpointMappings; coll.Add(new MessageEndpointMapping { Endpoint = "ProviderDomain", Messages = "DDD.Provider.Domain.Contracts", }); //coll.Add(new MessageEndpointMapping //{ // //AssemblyName = "DDD.Provider.Messages", // Endpoint = "ProviderDomain", // //Namespace = "DDD.Provider.Messages.Commands", // Messages = "DDD.Provider.Domain", // // TypeFullName= "DDD.Provider.Messages.Commands.AddNewContractorCommand, DDD.Provider.Messages" //}); //coll.Add(new MessageEndpointMapping //{ // AssemblyName = "DDD.Provider.Messages", // Endpoint = "ProviderDomain", // Messages = "DDD.Provider.Messages", // //Namespace = "DDD.Provider.Messages.Events" //}); return(config as T); } if (typeof(T) == typeof(MessageForwardingInCaseOfFaultConfig)) { var errorQUeue = new MessageForwardingInCaseOfFaultConfig { ErrorQueue = "ProviderErrorQueue" }; return(errorQUeue as T); } // leaving the rest of the configuration as is: return(ConfigurationManager.GetSection(typeof(T).Name) as T); }
public CustomFaultManager(ISendMessages sender, IProvideConfiguration <MessageForwardingInCaseOfFaultConfig> config) { this.sender = sender; this.config = config.GetConfiguration(); }
public T GetConfiguration <T>() where T : class, new() { if (typeof(T) == typeof(UnicastBusConfig)) { Debug.WriteLine("Getting UnicastBusConfig"); var config = new UnicastBusConfig(); config.MessageEndpointMappings.Add(new MessageEndpointMapping { AssemblyName = "NSBUnityError.Commands", Namespace = "NSBUnityError.Commands", Endpoint = "NSBUnityError.Host" }); return(config as T); } if (typeof(T) == typeof(TransportConfig)) { Debug.WriteLine("Getting TransportConfig"); var config = new TransportConfig { MaximumConcurrencyLevel = 1, MaxRetries = 3 }; return(config as T); } if (typeof(T) == typeof(MessageForwardingInCaseOfFaultConfig)) { Debug.WriteLine("Getting MessageForwardingInCaseOfFaultConfig"); var config = new MessageForwardingInCaseOfFaultConfig { ErrorQueue = "error" }; return(config as T); } if (typeof(T) == typeof(SecondLevelRetriesConfig)) { Debug.WriteLine("Getting SecondLevelRetriesConfig"); var config = new SecondLevelRetriesConfig { Enabled = true, NumberOfRetries = 3, TimeIncrease = TimeSpan.FromSeconds(10) }; return(config as T); } if (typeof(T) == typeof(AuditConfig)) { Debug.WriteLine("Getting AuditConfig"); var config = new AuditConfig { QueueName = "audit" }; return(config as T); } if (typeof(T) == typeof(AzureServiceBusQueueConfig)) { Debug.WriteLine("Getting AzureServiceBusQueueConfig"); var config = new AzureServiceBusQueueConfig { ConnectionString = _serviceBusConnectionString }; return(config as T); } return(null); }