/// <summary> /// A critical error is raised when timeout retrieval fails. /// By default we wait for 2 seconds for the storage to come back. /// This method allows to change the default and extend the wait time. /// </summary> /// <param name="config"></param> /// <param name="timeToWait">Time to wait before raising a critical error.</param> public static void TimeToWaitBeforeTriggeringCriticalErrorOnTimeoutOutages(this BusConfiguration config, TimeSpan timeToWait) { config.Settings.Set("TimeToWaitBeforeTriggeringCriticalErrorForTimeoutPersisterReceiver", timeToWait); }
/// <summary> /// Configures the given persistence to be used /// </summary> /// <typeparam name="T">The persistence definition eg <see cref="InMemoryPersistence"/>, NHibernate etc</typeparam> /// <param name="config">The configuration object since this is an extention method</param> public static PersistenceExtentions <T> UsePersistence <T>(this BusConfiguration config) where T : PersistenceDefinition { var type = typeof(PersistenceExtentions <>).MakeGenericType(typeof(T)); return((PersistenceExtentions <T>)Activator.CreateInstance(type, config.Settings)); }
/// <summary> /// Enables the given feature /// </summary> /// <param name="config"></param> /// <param name="featureType">The feature to disable</param> public static void DisableFeature(this BusConfiguration config, Type featureType) { config.Settings.Set(featureType.FullName, false); }
/// <summary> /// Configures the given serializer to be used /// </summary> /// <param name="config"></param> /// <param name="definitionType">The serializer definition eg <see cref="JsonSerializer"/>, <see cref="XmlSerializer"/> etc</param> public static void UseSerialization(this BusConfiguration config, Type definitionType) { var definition = (SerializationDefinition)Activator.CreateInstance(definitionType); config.Settings.Set("SelectedSerializer", definition); }
public static void FileShareDataBus(this BusConfiguration config, string basePath) { config.Settings.Set("FileShareDataBusPath", basePath); }
/// <summary> /// Sets the function to be used when critical error occurs. /// </summary> /// <param name="busConfiguration">The <see cref="BusConfiguration"/> to extend.</param> /// <param name="onCriticalError">Assigns the action to perform on critical error.</param> public static void DefineCriticalErrorAction(this BusConfiguration busConfiguration, Action <string, Exception> onCriticalError) { busConfiguration.Settings.Set("onCriticalErrorAction", onCriticalError); }
/// <summary> /// Loads all message handler assemblies in the runtime directory /// and specifies that the handlers in the given 'order' are to /// run before all others and in the order specified. /// </summary> public static void LoadMessageHandlers <T>(this BusConfiguration config, First <T> order) { config.Settings.Set("LoadMessageHandlers.Order.Types", order.Types); }
/// <summary> /// Configures messages that are not guaranteed to be delivered in the event of a computer failure or network problem. /// </summary> public static void DisableDurableMessages(this BusConfiguration config) { config.Settings.Set("Endpoint.DurableMessages", false); }
/// <summary> /// Use this method to change how auto subscribe works /// </summary> public static AutoSubscribeSettings AutoSubscribe(this BusConfiguration config) { return(new AutoSubscribeSettings(config)); }
internal HostInfoSettings(BusConfiguration config) { this.config = config; }
/// <summary> /// Enlist Worker with Master node defined in the config. /// </summary> public static void EnlistWithMSMQDistributor(this BusConfiguration config) { config.EnableFeature <Distributor.MSMQ.WorkerNode>(); }
/// <summary> /// Configure this endpoint as both a Distributor and a Worker. /// </summary> public static void AsMSMQMasterNode(this BusConfiguration config) { config.RunMSMQDistributor(); }
/// <summary> /// Entry point for transaction related configuration /// </summary> /// <param name="config"><see cref="Configure"/> instance.</param> public static TransactionSettings Transactions(this BusConfiguration config) { return(new TransactionSettings(config)); }
/// <summary> /// Configures the given persistence to be used /// </summary> /// <param name="config">The configuration object since this is an extention method</param> /// <param name="definitionType">The persistence definition eg <see cref="InMemoryPersistence"/>, NHibernate etc</param> public static PersistenceExtentions UsePersistence(this BusConfiguration config, Type definitionType) { return(new PersistenceExtentions(definitionType, config.Settings, null)); }
/// <summary> /// Forces this endpoint to use a legacy message driven subscription mode which makes it compatible with V5 and previous versions. /// </summary> /// <remarks> /// When scaling out with queue per endpoint instance the legacy mode should be used only in a single instance. Enabling the legacy /// mode in multiple instances will result in message duplication. /// </remarks> public static void UseLegacyMessageDrivenSubscriptionMode(this BusConfiguration busConfiguration) { busConfiguration.Settings.Set("NServiceBus.Routing.UseLegacyMessageDrivenSubscriptionMode", true); }
public static void TraceLogger(this BusConfiguration config) // ReSharper restore UnusedParameter.Global { LogManager.UseFactory(new TraceLoggerFactory()); }
/// <summary> /// Allows the user to control how the current endpoint behaves when scaled out. /// </summary> public static ScaleOutSettings ScaleOut(this BusConfiguration config) { return(new ScaleOutSettings(config)); }
/// <summary> /// Allows for customization of the second level retries /// </summary> public static SecondLevelRetriesSettings SecondLevelRetries(this BusConfiguration config) { return(new SecondLevelRetriesSettings(config)); }
/// <summary> /// Disables the given feature /// </summary> public static void DisableFeature <T>(this BusConfiguration config) where T : Feature { config.DisableFeature(typeof(T)); }
/// <summary> /// Configures NServiceBus to use the given transport. /// </summary> public static TransportExtensions UseTransport(this BusConfiguration busConfiguration, Type transportDefinitionType) { busConfiguration.Settings.Set("transportDefinitionType", transportDefinitionType); return(new TransportExtensions(busConfiguration.Settings)); }
/// <summary> /// Use in-memory fault management. /// </summary> public static void DiscardFailedMessagesInsteadOfSendingToErrorQueue(this BusConfiguration config) { config.EnableFeature <InMemoryFaultManager>(); config.DisableFeature <ForwarderFaultManager>(); }