Esempio n. 1
0
        /// <summary>
        /// Defaults the bus creator.
        /// </summary>
        /// <param name="serviceLocator">The service locator.</param>
        /// <param name="busConfiguration">The bus configuration.</param>
        /// <param name="configurator">The configurator.</param>
        /// <returns></returns>
        public static IOnewayBus DefaultBusCreator(IServiceLocator serviceLocator, BusConfigurationSection busConfiguration, Action <AbstractRhinoServiceBusConfiguration> configurator)
        {
            if (serviceLocator == null)
            {
                serviceLocator = ServiceLocatorManager.Current;
            }
            var configuration = new OnewayRhinoServiceBusConfiguration()
                                .UseMessageSerializer <RhinoServiceBus.Serializers.XmlMessageSerializer>()
                                .UseAbstractServiceLocator(serviceLocator);

            if (busConfiguration != null)
            {
                if (busConfiguration.MessageOwners == null)
                {
                    throw new ArgumentNullException("busConfiguration.MessageOwners");
                }
                configuration.UseConfiguration(busConfiguration);
            }
            if (configurator != null)
            {
                configurator(configuration);
            }
            configuration.Configure();
            return(serviceLocator.Resolve <IOnewayBus>());
        }
Esempio n. 2
0
        public virtual BusConfigurationSection ToBusConfiguration()
        {
            var config = new BusConfigurationSection();

            config.Bus.Endpoint                  = Endpoint;
            config.Bus.ThreadCount               = ThreadCount;
            config.Bus.NumberOfRetries           = NumberOfRetries;
            config.Bus.Name                      = Name;
            config.Bus.LoadBalancerEndpoint      = LoadBalancerEndpoint;
            config.Bus.LogEndpoint               = LogEndpoint;
            config.Bus.QueueIsolationLevel       = QueueIsolationLevel.ToString();
            config.Bus.Transactional             = Transactional.ToString();
            config.Bus.Path                      = Path;
            config.Bus.EnablePerformanceCounters = EnablePerformanceCounter;
            config.Security.Key                  = SecurityKey;
            foreach (var assembly in ScanAssemblies)
            {
                config.Assemblies.Add(new AssemblyElement {
                    Assembly = assembly
                });
            }
            foreach (var message in Messages)
            {
                config.MessageOwners.Add(new MessageOwnerElement
                {
                    Name          = message.Key,
                    Endpoint      = message.Value.Endpoint,
                    Transactional = message.Value.Transactional.ToString()
                });
            }
            return(config);
        }
Esempio n. 3
0
        static RuntimeBase()
        {
            var busConfiguration = new BusConfigurationSection();

            busConfiguration.Bus.Endpoint = "msmq://localhost/Dagent.nuget";
            ServiceBusManager.SetProvider(() => new RhinoServiceBusAbstractor(busConfiguration));
        }
 public AbstractRhinoServiceBusConfiguration UseStandaloneConfigurationFile(string fileName)
 {
     readConfiguration = () =>
     {
         configurationSection = ConfigurationManager.OpenMappedMachineConfiguration(new ConfigurationFileMap(fileName)).GetSection("rhino.esb") as BusConfigurationSection;
     };
     return(this);
 }
Esempio n. 5
0
 public virtual void UseConfiguration(BusConfigurationSection configurationSection)
 {
     busSection = configurationSection;
     if (config != null)
     {
         config.UseConfiguration(busSection);
     }
 }
Esempio n. 6
0
 protected AbstractRhinoServiceBusConfiguration()
 {
     readConfiguration = () =>
     {
         configurationSection = ConfigurationManager.GetSection("rhino.esb") as BusConfigurationSection;
     };
     ThreadCount     = 1;
     NumberOfRetries = 5;
     Transactional   = TransactionalOptions.FigureItOut;
 }
Esempio n. 7
0
        public void Can_use_different_config_correctly()
        {
            var windsorContainer = new WindsorContainer();
            var bootStrapper     = new SimpleBootStrapper(windsorContainer);
            var differentConfig  = new BusConfigurationSection();

            bootStrapper.UseConfiguration(differentConfig);
            bootStrapper.InitializeContainer();
            Assert.Equal(differentConfig, bootStrapper.ConfigurationSectionInUse);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="RhinoWrapServiceBusAbstractor"/> class.
 /// </summary>
 /// <param name="busConfiguration">The bus configuration.</param>
 public RhinoWrapServiceBusAbstractor(BusConfigurationSection busConfiguration)
     : base(busConfiguration)
 {
 }
Esempio n. 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OnewayRhinoServiceBusAbstractor"/> class.
 /// </summary>
 /// <param name="serviceLocator">The service locator.</param>
 /// <param name="busConfiguration">The bus configuration.</param>
 public OnewayRhinoServiceBusAbstractor(IServiceLocator serviceLocator, BusConfigurationSection busConfiguration)
     : this(serviceLocator, DefaultBusCreator(serviceLocator, busConfiguration, null))
 {
 }
Esempio n. 10
0
 protected override void ConfigureBusFacility(AbstractRhinoServiceBusConfiguration configuration)
 {
     ConfigurationSectionInUse = configuration.ConfigurationSection;
 }
Esempio n. 11
0
        /// <summary>
        /// Defaults the bus creator.
        /// </summary>
        /// <param name="serviceLocator">The service locator.</param>
        /// <param name="busConfiguration">The bus configuration.</param>
        /// <param name="configurator">The configurator.</param>
        /// <returns></returns>
        public static IStartableServiceBus DefaultBusCreator(IServiceLocator serviceLocator, BusConfigurationSection busConfiguration, Action <AbstractRhinoServiceBusConfiguration> configurator)
        {
            if (serviceLocator == null)
            {
                serviceLocator = ServiceLocatorManager.Current;
            }
            var configuration = new RhinoServiceBusConfiguration()
                                .UseMessageSerializer <RhinoServiceBus.Serializers.XmlMessageSerializer>()
                                .UseAbstractServiceLocator(serviceLocator);

            if (busConfiguration != null)
            {
                configuration.UseConfiguration(busConfiguration);
            }
            if (configurator != null)
            {
                configurator(configuration);
            }
            configuration.Configure();
            return(serviceLocator.Resolve <IStartableServiceBus>());
        }
Esempio n. 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OnewayRhinoServiceBusAbstractor"/> class.
 /// </summary>
 /// <param name="busConfiguration">The bus configuration.</param>
 public OnewayRhinoServiceBusAbstractor(BusConfigurationSection busConfiguration)
     : this(ServiceLocatorManager.Current, DefaultBusCreator(null, busConfiguration, null))
 {
 }
Esempio n. 13
0
 public MessageOwnersConfigReader(BusConfigurationSection configuration, ICollection <MessageOwner> messageOwners)
 {
     this.configuration = configuration;
     this.messageOwners = messageOwners;
 }
Esempio n. 14
0
 public void BusConfiguration(Func <HostConfiguration, HostConfiguration> configuration)
 {
     hostConfiguration = configuration(new HostConfiguration()).ToBusConfiguration();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RhinoWrapServiceBusAbstractor"/> class.
 /// </summary>
 /// <param name="serviceLocator">The service locator.</param>
 /// <param name="busConfiguration">The bus configuration.</param>
 public RhinoWrapServiceBusAbstractor(IServiceLocator serviceLocator, BusConfigurationSection busConfiguration)
     : base(serviceLocator, busConfiguration)
 {
 }
Esempio n. 16
0
 public virtual void UseConfiguration(BusConfigurationSection configurationSection)
 {
     config.UseConfiguration(configurationSection);
 }
 public AbstractRhinoServiceBusConfiguration UseConfiguration(BusConfigurationSection busConfiguration)
 {
     configurationSection = busConfiguration;
     return(this);
 }