public static FluentConfigurationSource UseMSMQ(this FluentConfigurationSource builder, Action <ConfigurationSettings> settingsFactory) { var settings = new ConfigurationSettings(); settingsFactory(settings); return(builder.UsingTransport <MSMQTransport>(context => { context.SetMulticastAddress(settings.MulticastAddress); context.SetHostname(settings.Hostname); })); }
public static FluentConfigurationSource UseRabbitMQ(this FluentConfigurationSource builder, Action <ConfigurationSettings> settingsFactory) { var settings = new ConfigurationSettings(); settingsFactory(settings); return(builder.UsingTransport <RabbitMQTransport>(context => { context.SetAutoDeleteQueues(settings.AutoDeleteQueues); context.SetConnectionString(settings.ConnectionString); context.SetExchange(settings.Exchange); })); }
public static FluentConfigurationSource UseTopShelf(this FluentConfigurationSource builder, Action <ConfigurationSettings> settingsFactory) { var settings = new ConfigurationSettings(); settingsFactory(settings); return(builder.UsingServiceHost <TopShelfHost>(context => { context.SetDescription(settings.Description); context.SetDisplayName(settings.DisplayName); context.SetPassword(settings.Password); context.SetServiceName(settings.ServiceName); context.SetUsername(settings.Username); context.SetUserType(settings.UserType); })); }
public static FluentConfigurationSource UseIIS(this FluentConfigurationSource builder, Action <ConfigurationSettings> settingsFactory) { var settings = new ConfigurationSettings(); settingsFactory(settings); if (settings.QueuePerWorkerEnabled) { builder.UsingQueueNameResolver <IISQueueNameResolver>(); } return(builder.UsingServiceHost <IISHost>(context => { context.SetAutomaticConfigurationFlag(settings.AutoConfigurationEnabled); })); }
public static FluentConfigurationSource UseRabbitMQ(this FluentConfigurationSource builder, Action <ConfigurationSettings> settingsFactory) { var settings = new ConfigurationSettings(); settingsFactory(settings); return(builder.UsingTransport <RabbitMQTransport>(context => { context.SetAutoDeleteQueues(settings.AutoDeleteQueues); context.SetConnectionString(settings.ConnectionString); context.SetExchange(settings.Exchange); context.SetPrefetchCountPerWorker(Convert.ToUInt16(settings.PrefetchCountPerWorker)); context.SetDelayQueuePrefetchCount(Convert.ToUInt16(settings.DelayQueuePrefetchCount)); context.SetPrimaryQueueArguments(settings.PrimaryQueueArguments); context.SetOnSendingMessageAction(settings.OnSendingMessageAction); })); }
public static FluentConfigurationSource UseStructureMap(this FluentConfigurationSource builder, Container container) { return(builder.UsingContainer(new StructureMapContainerAdapter(container))); }
public static FluentConfigurationSource UseRabbitMQ(this FluentConfigurationSource builder) { return(UseRabbitMQ(builder, settings => { })); }
public static FluentConfigurationSource UseAutoFac(this FluentConfigurationSource configBuilder, global::Autofac.IContainer container) { return(configBuilder.UsingContainer(new AutofacContainerAdapter(container))); }
/// <summary> /// Configures internal container and creates all needed instances to run the bus /// </summary> internal void ConfigureAndCreateContext(Action<FluentConfigurationSource> configurationFunction) { var fluentConfig = new FluentConfigurationSource(); if (configurationFunction != null) { // Populate the FluentConfigurationSource configurationFunction(fluentConfig); this.Populate(fluentConfig); } if (this.Container == null) { // Create a DefaultContainer, register it to itself // and then request it to resolve a instance of itself. // // This looks funky, but it ensures that everything is using the same container instance. this.Container = new DefaultContainer(); this.Container.Register<IContainer, DefaultContainer>(InstanceScope.Singleton); this.Container = this.Container.Resolve<IContainer>(); } // Create the global configuration context and set default values this.Container.Register<IConfigurationContext, ConfigurationContext>(InstanceScope.Singleton); this.ConfigurationContext = this.Container.Resolve<IConfigurationContext>(); this.ConfigurationContext.Container = this.Container; this.ConfigurationContext.TokenSource = new CancellationTokenSource(); // Parse Fluent and XML configuration - This builds up TypeMap so // RegisterTypeOrDefault below can grab the configured type for each // component this.Populate(fluentConfig.BuildUpConfiguration(this)); this.Populate(new XMLConfigurationSource().BuildUpConfiguration(this)); // Register Concrete types that will be used this.Container.Register<PrimaryConsumer, PrimaryConsumer>(InstanceScope.Singleton); this.Container.Register<DelayConsumer, DelayConsumer>(InstanceScope.Singleton); // Register all configured objects to the container this.RegisterTypeOrDefault<IAssemblyLocator, DefaultAssemblyLocator>(); this.RegisterTypeOrDefault<ISubscriptionKeyResolver, DefaultSubscriptionKeyResolver>(); this.RegisterTypeOrDefault<IQueueNameResolver, DefaultQueueNameResolver>(); this.RegisterTypeOrDefault<ILogger, DefaultLogger>(); this.RegisterTypeOrDefault<IBusClient, BusClient>(); this.RegisterTypeOrDefault<ISerializer, DefaultSerializer>(); this.RegisterTypeOrDefault<IBusHost, DefaultHost>(); this.RegisterTypeOrDefault<ITransport, DefaultTransport>(); // With TypeMap built, we can resolve the global instances for these now. this.ConfigurationContext.AssemblyLocator = this.Container.Resolve<IAssemblyLocator>(); this.ConfigurationContext.SubscriptionKeyResolver = this.Container.Resolve<ISubscriptionKeyResolver>(); this.ConfigurationContext.QueueNameResolver = this.Container.Resolve<IQueueNameResolver>(); this.ConfigurationContext.Logger = this.Container.Resolve<ILogger>(); this.ConfigurationContext.Serializer = this.Container.Resolve<ISerializer>(); this.ConfigurationContext.Transport = this.Container.Resolve<ITransport>(); // Final config pass is to build up subscriptions and filters via reflection this.Populate(new ReflectionConfigurationSource().BuildUpConfiguration(this)); // Set subscriptions and filters into the context this.ConfigurationContext.Subscriptions = this.Subscriptions.ToLookup(k => k.Key, v => v.Value); this.ConfigurationContext.InboundMessageFilters = this.InboundMessageFilters .SelectMany(p => p.Value.Distinct().Select(x => new { p.Key, Value = x })) .ToLookup(pair => pair.Key, pair => pair.Value); this.ConfigurationContext.OutboundMessageFilters = this.OutboundMessageFilters .SelectMany(p => p.Value.Distinct().Select(x => new { p.Key, Value = x })) .ToLookup(pair => pair.Key, pair => pair.Value); }
public static FluentConfigurationSource UseNLog(this FluentConfigurationSource builder) { return(builder.UsingLogger <NLogLogger>()); }
public static FluentConfigurationSource UseUnity(this FluentConfigurationSource builder, IUnityContainer container) { return(builder.UsingContainer(new UnityContainerAdapter(container))); }
public static FluentConfigurationSource UseLog4Net(this FluentConfigurationSource builder) { return(builder.UsingLogger <Log4NetLogger>()); }
public static FluentConfigurationSource UseJsonDotNet(this FluentConfigurationSource builder) { return(builder.UsingSerializer <JsonDotNetSerializer>()); }
public static FluentConfigurationSource UseTopShelf(this FluentConfigurationSource builder) { return(UseTopShelf(builder, settings => { })); }
public static FluentConfigurationSource UseCastleWindsor(this FluentConfigurationSource configBuilder, WindsorContainer container) { return(configBuilder.UsingContainer(new CastleWindsorContainerAdapter(container))); }
public static FluentConfigurationSource UseXMLSerialization(this FluentConfigurationSource builder) { return(builder.UsingSerializer <XmlSerializer>()); }
public static FluentConfigurationSource UseNInject(this FluentConfigurationSource builder, IKernel kernel) { return(builder.UsingContainer(new NInjectContainerAdapter(kernel))); }
public static FluentConfigurationSource UseCommonsLogging(this FluentConfigurationSource builder) { return(builder.UsingLogger <CommonsLogger>()); }