/// <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>()); }
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); }
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); }
public virtual void UseConfiguration(BusConfigurationSection configurationSection) { busSection = configurationSection; if (config != null) { config.UseConfiguration(busSection); } }
protected AbstractRhinoServiceBusConfiguration() { readConfiguration = () => { configurationSection = ConfigurationManager.GetSection("rhino.esb") as BusConfigurationSection; }; ThreadCount = 1; NumberOfRetries = 5; Transactional = TransactionalOptions.FigureItOut; }
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) { }
/// <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)) { }
protected override void ConfigureBusFacility(AbstractRhinoServiceBusConfiguration configuration) { ConfigurationSectionInUse = configuration.ConfigurationSection; }
/// <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>()); }
/// <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)) { }
public MessageOwnersConfigReader(BusConfigurationSection configuration, ICollection <MessageOwner> messageOwners) { this.configuration = configuration; this.messageOwners = messageOwners; }
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) { }
public virtual void UseConfiguration(BusConfigurationSection configurationSection) { config.UseConfiguration(configurationSection); }
public AbstractRhinoServiceBusConfiguration UseConfiguration(BusConfigurationSection busConfiguration) { configurationSection = busConfiguration; return(this); }