/// <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);
 }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 5
0
 public static void FileShareDataBus(this BusConfiguration config, string basePath)
 {
     config.Settings.Set("FileShareDataBusPath", basePath);
 }
Ejemplo n.º 6
0
 /// <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);
 }
Ejemplo n.º 8
0
 /// <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));
 }
Ejemplo n.º 10
0
 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();
 }
Ejemplo n.º 13
0
 /// <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));
 }
Ejemplo n.º 14
0
 /// <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);
 }
Ejemplo n.º 16
0
        public static void TraceLogger(this BusConfiguration config)
// ReSharper restore UnusedParameter.Global
        {
            LogManager.UseFactory(new TraceLoggerFactory());
        }
Ejemplo n.º 17
0
 /// <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));
 }
Ejemplo n.º 18
0
 /// <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));
 }
Ejemplo n.º 20
0
        /// <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));
        }
Ejemplo n.º 21
0
 /// <summary>
 /// Use in-memory fault management.
 /// </summary>
 public static void DiscardFailedMessagesInsteadOfSendingToErrorQueue(this BusConfiguration config)
 {
     config.EnableFeature <InMemoryFaultManager>();
     config.DisableFeature <ForwarderFaultManager>();
 }