Example #1
0
        /// <summary>
        /// The run method
        /// </summary>
        /// <param name="config">
        /// The config.
        /// </param>
        public void Run(Configure config)
        {
            Logger.Info("Statup.Run()");

            var initMessage = new MyMessage
                                  {
                                      SomeId = "carlos",
                                      LargeBlob = new DataBusProperty<byte[]>(Guid.NewGuid().ToByteArray())
                                  };
            var anotherMessage = new AnotherSagaCommand { SomeId = initMessage.SomeId, SleepHowLong = 2000 };

            Thread.Sleep(5000);
            this.bus.Send(initMessage);

            Thread.Sleep(1000);

            for (var i = 0; i < 5; i++)
            {
                anotherMessage.SleepHowLong = i;
                this.bus.SendLocal(anotherMessage);
            }

            anotherMessage.SleepHowLong = 0;
            this.bus.SendLocal(anotherMessage);
            this.bus.SendLocal(anotherMessage);
            this.bus.SendLocal(anotherMessage);
        }
Example #2
0
        public void Install(string identity, Configure config)
        {
            if (config.Settings.Get<bool>("Endpoint.SendOnly"))
            {
                return;
            }

            if (!config.CreateQueues())
            {
                return;
            }

            var wantQueueCreatedInstances = config.Builder.BuildAll<IWantQueueCreated>().ToList();

            foreach (var wantQueueCreatedInstance in wantQueueCreatedInstances.Where(wantQueueCreatedInstance => wantQueueCreatedInstance.ShouldCreateQueue()))
            {
                if (wantQueueCreatedInstance.Address == null)
                {
                    throw new InvalidOperationException(string.Format("IWantQueueCreated implementation {0} returned a null address", wantQueueCreatedInstance.GetType().FullName));
                }

                QueueCreator.CreateQueueIfNecessary(wantQueueCreatedInstance.Address, identity);
                Logger.DebugFormat("Verified that the queue: [{0}] existed", wantQueueCreatedInstance.Address);
            }
        }
        public static BrokeredMessage ToBrokeredMessage(this TransportMessage message, SendOptions options, SettingsHolder settings, bool expectDelay, Configure config)
        {
            var brokeredMessage = BrokeredMessageBodyConversion.InjectBody(message.Body);

            SetHeaders(message, options, settings, config, brokeredMessage);

            var timeToSend = DelayIfNeeded(options, expectDelay);
                        
            if (timeToSend.HasValue)
                brokeredMessage.ScheduledEnqueueTimeUtc = timeToSend.Value;

            TimeSpan? timeToLive = null;
            if (message.TimeToBeReceived < TimeSpan.MaxValue)
            {
                timeToLive = message.TimeToBeReceived;
            }
            else if (options.TimeToBeReceived.HasValue && options.TimeToBeReceived < TimeSpan.MaxValue)
            {
                timeToLive = options.TimeToBeReceived.Value;
            }

            if (timeToLive.HasValue)
            {
                if (timeToLive.Value <= TimeSpan.Zero) return null;

                brokeredMessage.TimeToLive = timeToLive.Value;
            }
            GuardMessageSize(brokeredMessage);

            return brokeredMessage;
        }
 private void ConfigurePublishingInfrastructure(Configure config, AzureServiceBusQueueConfig configSection)
 {
     config.Configurer.ConfigureComponent<AzureServiceBusTopicPublisher>(DependencyLifecycle.InstancePerCall);
     config.Configurer.ConfigureProperty<AzureServiceBusTopicPublisher>(t => t.MaxDeliveryCount, configSection.MaxDeliveryCount);
     
     config.Configurer.ConfigureComponent<AzureServiceBusTopicSubscriptionManager>(DependencyLifecycle.InstancePerCall);
 }
 public void SetUp()
 {
     config = Configure.With(new[] { typeof(MySaga).Assembly})
         .DefaultBuilder()
         .Sagas()
         .NHibernateSagaPersister();
 }
 void EnablingSla(Configure configure)
 {
     #region enable-sla
     // in this version there was no granular control over individual counters
     configure.EnablePerformanceCounters();
     #endregion
 }
 void EnablingCriticalTime(Configure configure)
 {
     #region enable-criticaltime
     // in this version there was no granular control over individual counters
     configure.EnablePerformanceCounters();
     #endregion
 }
 void RenamePrincipalHack(Configure configure)
 {
     #region 3to4RenamePrincipalHack
     var unicastBus = configure.UnicastBus();
     unicastBus.RunHandlersUnderIncomingPrincipal(true);
     #endregion
 }
        protected override void Initialize(Configure config)
        {
            connectionStringFunc = () => "Url = http://localhost:8080; DefaultDatabase=MyDB";
            database = "CustomDatabase";

            config.RavenPersistence(connectionStringFunc, database);
        }
        /// <summary>
        /// Wraps the given configuration object but stores the same 
        /// builder and configurer properties.
        /// </summary>
        /// <param name="config"></param>
        public void Configure(Configure config)
        {
            Builder = config.Builder;
            Configurer = config.Configurer;

            transportConfig = Configurer.ConfigureComponent<XmsTransport>(ComponentCallModelEnum.Singleton);

            var cfg = GetConfigSection<XmsTransportConfig>();

            var dictionary = new Dictionary<string, string>();
            if (cfg != null)
            {
                transportConfig.ConfigureProperty(t => t.InputQueue, cfg.InputQueue);
                transportConfig.ConfigureProperty(t => t.NumberOfWorkerThreads, cfg.NumberOfWorkerThreads);
                transportConfig.ConfigureProperty(t => t.ErrorQueue, cfg.ErrorQueue);
                transportConfig.ConfigureProperty(t => t.MaxRetries, cfg.MaxRetries);

                if(cfg.Aliases!=null)
                {
                    dictionary = cfg.Aliases.ToDictionary(x => x.Name, y => y.Value);
                }
            }

            transportConfig.ConfigureProperty(t => t.Aliases, dictionary);

            var unicastConfig = GetConfigSection<UnicastBusConfig>();

            if (unicastConfig != null)
            {
                if (!string.IsNullOrEmpty(unicastConfig.ForwardReceivedMessagesTo))
                    transportConfig.ConfigureProperty(t => t.ForwardReceivedMessagesTo, unicastConfig.ForwardReceivedMessagesTo);
            }
        }
        CustomRavenConfig(Configure configure)
        {
            #region OldRavenDBPersistenceInitialization

            configure.RavenPersistence();
            configure.RavenSagaPersister();
            configure.RavenSubscriptionStorage();
            configure.UseRavenTimeoutPersister();
            configure.UseRavenGatewayDeduplication();
            configure.UseRavenGatewayPersister();

            #endregion

            #region Version2_5RavenDBPersistenceInitialization

            // Need to call this method
            configure.RavenDBStorage();
            // Call this method to use Raven saga storage
            configure.UseRavenDBSagaStorage();
            // Call this method to use Raven subscription storage
            configure.UseRavenDBSubscriptionStorage();
            // Call this method to use Raven timeout storage
            configure.UseRavenDBTimeoutStorage();
            // Call this method to use Raven deduplication storage for the Gateway
            configure.UseRavenDBGatewayDeduplicationStorage();
            // Call this method to use the  Raven Gateway storage method
            configure.UseRavenDBGatewayStorage();

            #endregion
        }
        public void Install(string identity, Configure config)
        {
            Console.Title = "Complaint.Frontend";

            Console.WriteLine(
                "Hy there from CustomWindowsEverytimeInstaller! I will run every time! Identity {0}", identity);
        }
        public void Configure(Configure config)
        {
            this.Builder = config.Builder;
            this.Configurer = config.Configurer;

            this.config = Configurer.ConfigureComponent<RabbitMqTransport>(ComponentCallModelEnum.Singleton);
            var cfg = NServiceBus.Configure.GetConfigSection<RabbitMqTransportConfig>();

            if(cfg != null)
            {
                this.config.ConfigureProperty(t => t.NumberOfWorkerThreads, cfg.NumberOfWorkerThreads);
                this.config.ConfigureProperty(t => t.MaximumNumberOfRetries, cfg.MaxRetries);
                this.config.ConfigureProperty(t => t.InputBroker, cfg.InputBroker);
                this.config.ConfigureProperty(t => t.InputExchange, cfg.InputExchange);
                this.config.ConfigureProperty(t => t.InputExchangeType, cfg.InputExchangeType);
                this.config.ConfigureProperty(t => t.InputQueue, cfg.InputQueue);
                this.config.ConfigureProperty(t => t.InputRoutingKeys, cfg.InputRoutingKeys);
                this.config.ConfigureProperty(t => t.DoNotCreateInputExchange, cfg.DoNotCreateInputExchange);
                this.config.ConfigureProperty(t => t.DoNotCreateInputQueue, cfg.DoNotCreateInputQueue);
                this.config.ConfigureProperty(t => t.ErrorBroker, cfg.ErrorBroker);
                this.config.ConfigureProperty(t => t.ErrorExchange, cfg.ErrorExchange);
                this.config.ConfigureProperty(t => t.ErrorExchangeType, cfg.ErrorExchangeType);
                this.config.ConfigureProperty(t => t.ErrorQueue, cfg.ErrorQueue);
                this.config.ConfigureProperty(t => t.ErrorRoutingKeys, cfg.ErrorRoutingKeys);
                this.config.ConfigureProperty(t => t.DoNotCreateErrorExchange, cfg.DoNotCreateErrorExchange);
                this.config.ConfigureProperty(t => t.DoNotCreateErrorQueue, cfg.DoNotCreateErrorQueue);

                this.config.ConfigureProperty(t => t.TransactionTimeout, TimeSpan.FromMinutes(cfg.TransactionTimeout));
                this.config.ConfigureProperty(t => t.SendAcknowledgement, cfg.SendAcknowledgement);
            }
        }
        public SqsDequeueStrategy(Configure config)
        {
			if (config != null)
				_purgeOnStartup = config.PurgeOnStartup();
			else
				_purgeOnStartup = false;
        }
        public void SetUp()
        {
            config = Configure.With()
          .SpringBuilder()
          .DBSubcriptionStorage();

        }
 public SerializationMapper(IMessageMapper mapper, Conventions conventions, Configure configure)
 {
     jsonSerializer = new JsonMessageSerializer(mapper);
     xmlSerializer = new XmlMessageSerializer(mapper, conventions);
     List<Type> messageTypes = configure.TypesToScan.Where(conventions.IsMessageType).ToList();
     xmlSerializer.Initialize(messageTypes);
 }
Example #17
0
        void CustomConnectionString(Configure configure)
        {
            #region rabbitmq-config-connectionstring-in-code

            configure.UseTransport<RabbitMQ>(() => "My custom connection string");
            #endregion
        }
#pragma warning disable 1591 // Xml Comments
		public void Initialize(Configure configure)
        {
            var section = _configurationManager.GetSection("BifrostConfig") as BifrostConfig;
            if( section != null )
            {
                if( section.Commands != null )
                {
                    
                }
                if( section.DefaultStorage != null )
                {
                    var configuration = section.DefaultStorage.GetConfiguration();
                    configure.Container.Bind<IEntityContextConfiguration>(configuration);
                    configure.Container.Bind(configuration.Connection.GetType(), configuration.Connection);
                    configure.Container.Bind(typeof(IEntityContext<>), section.DefaultStorage.EntityContextType);
                }

                if( section.Events != null )
                {
                    configure.Events.RepositoryType = section.Events.RepositoryType;
                }
				if( section.Sagas != null )
				{
					configure.Sagas.LibrarianType = section.Sagas.LibrarianType;
				}
            }
		}
 public void Install(string identity, Configure config)
 {
     if (RunInstaller)
     {
         new OptimizedSchemaUpdate(Configuration).Execute(false, true);
     }
 }
 public void SetUp()
 {
     config = Configure.With(new Type[] { })
                         .DefineEndpointName("Foo")
                         .DefaultBuilder()
                         .UseNHibernateSubscriptionPersister();
 }
 public void SetUp()
 {
     config = Configure.With(new[] { typeof(MySaga).Assembly})
         .DefaultBuilder()
         .Sagas()
         .NHibernateSagaPersisterWithSQLiteAndAutomaticSchemaGeneration();
 }
Example #22
0
        Usage(Configure configure)
        {
            #region SLRConfigurationSourceUsage

            configure.CustomConfigurationSource(new ConfigurationSource());

            #endregion
        }
Example #23
0
        Usage(Configure configure)
        {
            #region EncryptionServiceSimple

            configure.RijndaelEncryptionService();

            #endregion
        }
        DefineExpress(Configure configure)
        {
            #region ExpressMessageConvention

            configure.DefiningExpressMessagesAs(t => t.Name.EndsWith("Express"));

            #endregion
        }
Example #25
0
    Usage(Configure configure)
    {
        #region Unity

        configure.UnityBuilder();

        #endregion
    }
Example #26
0
        Usage(Configure configure)
        {
            #region UseCustomConfigurationSourceForErrorQueueConfig

            configure.CustomConfigurationSource(new ConfigurationSource());

            #endregion
        }
Example #27
0
        Usage(Configure configure)
        {
            #region Spring

            configure.SpringFrameworkBuilder();

            #endregion
        }
Example #28
0
        Usage(Configure configure)
        {
            #region ConfiguringMsmqPersistence

            configure.MsmqSubscriptionStorage();

            #endregion
        }
Example #29
0
        void EnlistWithDistributor(Configure configure)
        {
            #region 3to4EnlistWithDistributor

            configure.EnlistWithDistributor();

            #endregion
        }
Example #30
0
        void RunDistributor(Configure configure)
        {
            #region 3to4RunDistributor

            configure.RunDistributor();

            #endregion
        }