コード例 #1
0
 /// <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);
 }
コード例 #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));
        }
コード例 #3
0
 /// <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);
 }
コード例 #4
0
        /// <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);
        }
コード例 #5
0
 public static void FileShareDataBus(this BusConfiguration config, string basePath)
 {
     config.Settings.Set("FileShareDataBusPath", basePath);
 }
コード例 #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);
 }
コード例 #7
0
 /// <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);
 }
コード例 #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);
 }
コード例 #9
0
 /// <summary>
 /// Use this method to change how auto subscribe works
 /// </summary>
 public static AutoSubscribeSettings AutoSubscribe(this BusConfiguration config)
 {
     return(new AutoSubscribeSettings(config));
 }
コード例 #10
0
 internal HostInfoSettings(BusConfiguration config)
 {
     this.config = config;
 }
コード例 #11
0
 /// <summary>
 ///     Enlist Worker with Master node defined in the config.
 /// </summary>
 public static void EnlistWithMSMQDistributor(this BusConfiguration config)
 {
     config.EnableFeature <Distributor.MSMQ.WorkerNode>();
 }
コード例 #12
0
 /// <summary>
 /// Configure this endpoint as both a Distributor and a Worker.
 /// </summary>
 public static void AsMSMQMasterNode(this BusConfiguration config)
 {
     config.RunMSMQDistributor();
 }
コード例 #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));
 }
コード例 #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));
 }
コード例 #15
0
 /// <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);
 }
コード例 #16
0
        public static void TraceLogger(this BusConfiguration config)
// ReSharper restore UnusedParameter.Global
        {
            LogManager.UseFactory(new TraceLoggerFactory());
        }
コード例 #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));
 }
コード例 #18
0
 /// <summary>
 /// Allows for customization of the second level retries
 /// </summary>
 public static SecondLevelRetriesSettings SecondLevelRetries(this BusConfiguration config)
 {
     return(new SecondLevelRetriesSettings(config));
 }
コード例 #19
0
 /// <summary>
 /// Disables the given feature
 /// </summary>
 public static void DisableFeature <T>(this BusConfiguration config) where T : Feature
 {
     config.DisableFeature(typeof(T));
 }
コード例 #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));
        }
コード例 #21
0
 /// <summary>
 /// Use in-memory fault management.
 /// </summary>
 public static void DiscardFailedMessagesInsteadOfSendingToErrorQueue(this BusConfiguration config)
 {
     config.EnableFeature <InMemoryFaultManager>();
     config.DisableFeature <ForwarderFaultManager>();
 }