public void Configure(AbstractRhinoServiceBusFacility facility, IConfiguration configuration) { var bus = configuration.Children["bus"]; if (bus == null) return; var loadBalancerEndpointAsString = bus.Attributes["loadBalancerEndpoint"]; if(string.IsNullOrEmpty(loadBalancerEndpointAsString)) return; Uri loadBalancerEndpoint; if (Uri.TryCreate( loadBalancerEndpointAsString, UriKind.Absolute, out loadBalancerEndpoint) == false) { throw new ConfigurationErrorsException( "Attribute 'loadBalancerEndpoint' on 'bus' has an invalid value '" + loadBalancerEndpointAsString + "'"); } facility.Kernel.Register( Component.For<LoadBalancerMessageModule>() .DependsOn(new { loadBalancerEndpoint }) ); facility.AddMessageModule<LoadBalancerMessageModule>(); }
public void Configure(AbstractRhinoServiceBusFacility facility, IConfiguration configuration) { var kernel = facility.Kernel; Uri logEndpoint; var bus = configuration.Children["bus"]; if (bus == null) { return; } var uriString = bus.Attributes["logEndpoint"]; if (uriString == null) { return; } if (Uri.TryCreate(uriString, UriKind.Absolute, out logEndpoint) == false) { throw new ConfigurationErrorsException( "Attribute 'logEndpoint' on 'bus' has an invalid value '" + uriString + "'"); } kernel.Register( Component.For <MessageLoggingModule>() .DependsOn(new { logQueue = logEndpoint }) ); facility.InsertMessageModuleAtFirst <MessageLoggingModule>(); }
public void Configure(AbstractRhinoServiceBusFacility facility, IConfiguration configuration) { if (facility.Endpoint.Scheme.Equals("rhino.queues", StringComparison.InvariantCultureIgnoreCase) == false) return; IConfiguration busConfig = facility.FacilityConfig.Children["bus"]; if (busConfig == null) throw new ConfigurationErrorsException("Could not find 'bus' node in configuration"); var name = busConfig.Attributes["name"]; if (string.IsNullOrEmpty(name)) throw new ConfigurationErrorsException("Could not find attribute 'name' in node 'bus' in configuration"); var path = Path.GetFullPath(AppDomain.CurrentDomain.BaseDirectory); facility.Kernel.Register( Component.For<ISubscriptionStorage>() .LifeStyle.Is(LifestyleType.Singleton) .ImplementedBy(typeof(PhtSubscriptionStorage)) .DependsOn(new { subscriptionPath = Path.Combine(path, name + "_subscriptions.esent") }), Component.For<ITransport>() .LifeStyle.Is(LifestyleType.Singleton) .ImplementedBy(typeof(RhinoQueuesTransport)) .DependsOn(new { threadCount = facility.ThreadCount, endpoint = facility.Endpoint, queueIsolationLevel = facility.IsolationLevel, numberOfRetries = facility.NumberOfRetries, path = Path.Combine(path, name + ".esent") }) ); }
public void Configure(AbstractRhinoServiceBusFacility facility, IConfiguration configuration) { if (facility.Endpoint.Scheme.Equals("msmq", StringComparison.InvariantCultureIgnoreCase) == false) { return; } if (facility.UseFlatQueue) { queueStrategyImpl = typeof(FlatQueueStrategy); } if (facility.DisableAutoQueueCreation == false) { facility.Kernel.Register(Component.For <QueueCreationModule>()); } facility.Kernel.Register( Component.For <IMessageBuilder <Message> >() .LifeStyle.Is(LifestyleType.Singleton) .ImplementedBy <MsmqMessageBuilder>(), Component.For <IQueueStrategy>() .LifeStyle.Is(LifestyleType.Singleton) .ImplementedBy(queueStrategyImpl) .DependsOn(new { endpoint = facility.Endpoint }), Component.For <IMsmqTransportAction>() .ImplementedBy <ErrorAction>() .DependsOn(new { numberOfRetries = facility.NumberOfRetries }), Component.For <ISubscriptionStorage>() .LifeStyle.Is(LifestyleType.Singleton) .ImplementedBy(typeof(MsmqSubscriptionStorage)) .DependsOn(new { queueBusListensTo = facility.Endpoint }), Component.For <ITransport>() .LifeStyle.Is(LifestyleType.Singleton) .ImplementedBy(typeof(MsmqTransport)) .DependsOn(new { threadCount = facility.ThreadCount, endpoint = facility.Endpoint, queueIsolationLevel = facility.IsolationLevel, numberOfRetries = facility.NumberOfRetries, transactional = facility.Transactional, consumeInTransaction = facility.ConsumeInTransaction, }), AllTypes.FromAssembly(typeof(IMsmqTransportAction).Assembly) .BasedOn <IMsmqTransportAction>() .Unless(x => x == typeof(ErrorAction)) .WithService.FirstInterface() .Configure(registration => registration.LifeStyle.Is(LifestyleType.Singleton)) ); }
public void Configure(AbstractRhinoServiceBusFacility facility, IConfiguration configuration) { if (facility.Endpoint.Scheme.Equals("rhino.queues", StringComparison.InvariantCultureIgnoreCase) == false) { return; } IConfiguration busConfig = configuration.Children["bus"]; if (busConfig == null) { throw new ConfigurationErrorsException("Could not find 'bus' node in configuration"); } var name = busConfig.Attributes["name"]; if (string.IsNullOrEmpty(name)) { throw new ConfigurationErrorsException("Could not find attribute 'name' in node 'bus' in configuration"); } var path = busConfig.Attributes["path"]; if (string.IsNullOrEmpty(path)) { path = Path.GetFullPath(AppDomain.CurrentDomain.BaseDirectory); } facility.Kernel.Register( Component.For <ISubscriptionStorage>() .LifeStyle.Is(LifestyleType.Singleton) .ImplementedBy(typeof(PhtSubscriptionStorage)) .DependsOn(new { subscriptionPath = Path.Combine(path, name + "_subscriptions.esent") }), Component.For <ITransport>() .LifeStyle.Is(LifestyleType.Singleton) .ImplementedBy(typeof(RhinoQueuesTransport)) .DependsOn(new { threadCount = facility.ThreadCount, endpoint = facility.Endpoint, queueIsolationLevel = facility.IsolationLevel, numberOfRetries = facility.NumberOfRetries, path = Path.Combine(path, name + ".esent") }), Component.For <IMessageBuilder <MessagePayload> >() .ImplementedBy <RhinoQueuesMessageBuilder>() .LifeStyle.Is(LifestyleType.Singleton) ); }
public void Configure(AbstractRhinoServiceBusFacility facility, IConfiguration configuration) { if (facility.Endpoint.Scheme.Equals("msmq", StringComparison.InvariantCultureIgnoreCase) == false) return; if(facility.UseFlatQueue) { queueStrategyImpl = typeof (FlatQueueStrategy); } if(facility.DisableAutoQueueCreation==false) { facility.Kernel.Register(Component.For<QueueCreationModule>()); } facility.Kernel.Register( Component.For<IQueueStrategy>() .LifeStyle.Is(LifestyleType.Singleton) .ImplementedBy(queueStrategyImpl) .DependsOn(new { endpoint = facility.Endpoint }), Component.For<IMsmqTransportAction>() .ImplementedBy<ErrorAction>() .DependsOn(new { numberOfRetries = facility.NumberOfRetries }), Component.For<ISubscriptionStorage>() .LifeStyle.Is(LifestyleType.Singleton) .ImplementedBy(typeof(MsmqSubscriptionStorage)) .DependsOn(new { queueBusListensTo = facility.Endpoint }), Component.For<ITransport>() .LifeStyle.Is(LifestyleType.Singleton) .ImplementedBy(typeof(MsmqTransport)) .DependsOn(new { threadCount = facility.ThreadCount, endpoint = facility.Endpoint, queueIsolationLevel = facility.IsolationLevel, numberOfRetries = facility.NumberOfRetries, transactional = facility.Transactional, consumeInTransaction = facility.ConsumeInTransaction, }), AllTypes.Of<IMsmqTransportAction>() .FromAssembly(typeof(IMsmqTransportAction).Assembly) .Unless(x => x == typeof(ErrorAction)) .WithService.FirstInterface() .Configure(registration => registration.LifeStyle.Is(LifestyleType.Singleton)) ); }
public void Configure(AbstractRhinoServiceBusFacility facility, IConfiguration configuration) { var kernel = facility.Kernel; var security = configuration.Children["security"]; if (security == null) { kernel.Register( Component.For <IValueConvertor <WireEcryptedString> >() .ImplementedBy <ThrowingWireEcryptedStringConvertor>() ); kernel.Register( Component.For <IElementSerializationBehavior>() .ImplementedBy <ThrowingWireEncryptedMessageConvertor>() ); return; } var key = security.Children["key"]; if (key == null || string.IsNullOrEmpty(key.Value)) { throw new ConfigurationErrorsException("<security> element must have a <key> element with content"); } var keyBuffer = Convert.FromBase64String(key.Value); kernel.Register( Component.For <IEncryptionService>() .ImplementedBy <RijndaelEncryptionService>() .DependsOn(new { key = keyBuffer, }) .Named("esb.security") ); kernel.Register( Component.For <IValueConvertor <WireEcryptedString> >() .ImplementedBy <WireEcryptedStringConvertor>() .ServiceOverrides(ServiceOverride.ForKey("encryptionService").Eq("esb.security")) ); kernel.Register( Component.For <IElementSerializationBehavior>() .ImplementedBy <WireEncryptedMessageConvertor>() .ServiceOverrides(ServiceOverride.ForKey("encryptionService").Eq("esb.security")) ); }
public void Configure(AbstractRhinoServiceBusFacility facility, IConfiguration configuration) { var kernel = facility.Kernel; var security = configuration.Children["security"]; if (security == null) { kernel.Register( Component.For<IValueConvertor<WireEcryptedString>>() .ImplementedBy<ThrowingWireEcryptedStringConvertor>() ); kernel.Register( Component.For<IElementSerializationBehavior>() .ImplementedBy<ThrowingWireEncryptedMessageConvertor>() ); return; } var key = security.Children["key"]; if (key == null || string.IsNullOrEmpty(key.Value)) throw new ConfigurationErrorsException("<security> element must have a <key> element with content"); var keyBuffer = Convert.FromBase64String(key.Value); kernel.Register( Component.For<IEncryptionService>() .ImplementedBy<RijndaelEncryptionService>() .DependsOn(new { key = keyBuffer, }) .Named("esb.security") ); kernel.Register( Component.For<IValueConvertor<WireEcryptedString>>() .ImplementedBy<WireEcryptedStringConvertor>() .ServiceOverrides(ServiceOverride.ForKey("encryptionService").Eq("esb.security")) ); kernel.Register( Component.For<IElementSerializationBehavior>() .ImplementedBy<WireEncryptedMessageConvertor>() .ServiceOverrides(ServiceOverride.ForKey("encryptionService").Eq("esb.security")) ); }
public void Configure(AbstractRhinoServiceBusFacility facility, IConfiguration configuration) { var bus = configuration.Children["bus"]; if (bus == null) { return; } var loadBalancerEndpointAsString = bus.Attributes["loadBalancerEndpoint"]; if (string.IsNullOrEmpty(loadBalancerEndpointAsString)) { return; } Uri loadBalancerEndpoint; if (Uri.TryCreate( loadBalancerEndpointAsString, UriKind.Absolute, out loadBalancerEndpoint) == false) { throw new ConfigurationErrorsException( "Attribute 'loadBalancerEndpoint' on 'bus' has an invalid value '" + loadBalancerEndpointAsString + "'"); } var endpoint = new Endpoint { Uri = loadBalancerEndpoint }; facility.Kernel.Register( Component.For <LoadBalancerMessageModule>() .DependsOn(new { loadBalancerEndpoint = endpoint.Uri }) ); facility.AddMessageModule <LoadBalancerMessageModule>(); }
public void Configure(AbstractRhinoServiceBusFacility facility, IConfiguration configuration) { throw new NotImplementedException(); }