Пример #1
0
        public void Init()
        {
            //var bus = NServiceBus.Configure.With()
            //    .DefaultBuilder()
            //    .BinarySerializer()
            //    .MsmqTransport()
            //    .IsTransactional(true)
            //    .PurgeOnStartup(false)
            //    .UnicastBus()
            //    .LoadMessageHandlers()
            //    .ImpersonateSender(false)
            //    .Sagas()
            //    .CreateBus()
            //    .Start();

            NServiceBus.Configure c = NServiceBus.Configure.With()
                                      // .StructureMapBuilder(_container)
                                      .DefaultBuilder()
                                      .BinarySerializer()
                                      .MsmqSubscriptionStorage()
                                      .MsmqTransport()
                                      .IsTransactional(true)
                                      .PurgeOnStartup(true)
                                      .UnicastBus()
                                      .LoadMessageHandlers()
                                      .Sagas();
            // .SetSagaPersister(_container);

            //NServiceBus.Configure.With()
            //    .DefaultBuilder()
            //    .BinarySerializer()
            //    .Sagas();
        }
Пример #2
0
 private static void BootstrapNServiceBus()
 {
     Configure.With()
     .Log4Net()
     .StructureMapBuilder(ObjectFactory.Container)
     .AzureMessageQueue().JsonSerializer()
     .TimeoutManager()
     .UnicastBus()
     .LoadMessageHandlers(First <TimeoutMessageHandler> .Then <SagaMessageHandler>())
     .IsTransactional(true)
     .CreateBus()
     .Start();
 }
Пример #3
0
 private static void BootstrapNServiceBus()
 {
     Configure.With()
     .Log4Net()
     .StructureMapBuilder(ObjectFactory.Container)
     .AzureMessageQueue().JsonSerializer()
     .RunTimeoutManager()
     .UseAzureTimeoutPersister()
     .ListenOnAzureStorageQueues()
     .UnicastBus()
     .LoadMessageHandlers()
     .IsTransactional(true)
     .CreateBus()
     .Start();
 }
 /// <summary>
 /// Disables the automatic creation of the database schema.
 /// </summary>
 /// <param name="config">The configuration object.</param>
 /// <returns>The configuration object.</returns>
 public static Configure DisableNHibernateGatewayDeduplicationInstall(this Configure config)
 {
     Deduplication.NHibernate.Installer.Installer.RunInstaller = false;
     return(config);
 }
 /// <summary>
 /// Stores subscription data in memory.
 /// This storage are for development scenarios only
 /// </summary>
 /// <param name="config"></param>
 /// <returns></returns>
 public static Configure InMemorySubscriptionStorage(this Configure config)
 {
     config.Configurer.ConfigureComponent <InMemorySubscriptionStorage>(DependencyLifecycle.SingleInstance);
     return(config);
 }
 public static Configure OnCriticalError(this Configure config)
 {
     onCriticalErrorAction("A critical error occurred.", new Exception());
     return(config);
 }
 public static Configure DefineCriticalErrorAction(this Configure config, Action onCriticalError)
 {
     onCriticalErrorAction = (s, exception) => onCriticalError();
     return(config);
 }
        /// <summary>
        ///     Execute the configured Critical error action.
        /// </summary>
        /// <param name="config">The configuration object.</param>
        /// <param name="errorMessage">The error message.</param>
        /// <param name="exception">The critical exception thrown.</param>
        public static void RaiseCriticalError(this Configure config, string errorMessage, Exception exception)
        {
            LogManager.GetLogger("NServiceBus").Fatal(errorMessage, exception);

            onCriticalErrorAction(errorMessage, exception);
        }
 /// <summary>
 ///     Sets the function to be used when critical error occurs.
 /// </summary>
 /// <param name="config">The configuration object.</param>
 /// <param name="onCriticalError">Assigns the action to perform on critical error.</param>
 /// <returns>The configuration object.</returns>
 public static Configure DefineCriticalErrorAction(this Configure config,
                                                   Action <string, Exception> onCriticalError)
 {
     onCriticalErrorAction = onCriticalError;
     return(config);
 }