public RabbitMqGateway(string connectionString, int eventSubscriberThreadCount, int commandHandlerThreadCount, ILocator locator) { _eventSubscriberThreadCount = eventSubscriberThreadCount; _commandHandlerThreadCount = commandHandlerThreadCount; var adapter = new EasyNetQContainerAdapter(locator); RabbitHutch.SetContainerFactory(() => adapter); _externalMessageBus = RabbitHutch.CreateBus(connectionString, register => register.Register<IConsumerErrorStrategy, MyClass>()); _eventBus = locator.Resolve<Core.IEventBus>(); _commandHandlerFactory = locator.Resolve<ICommandHandlerFactory>(); var a = locator.Resolve<IConsumerErrorStrategy>(); }
public RabbitMqGateway(string connectionString, int eventSubscriberThreadCount, int commandHandlerThreadCount, ILocator locator) { _eventSubscriberThreadCount = eventSubscriberThreadCount; _commandHandlerThreadCount = commandHandlerThreadCount; var adapter = new EasyNetQContainerAdapter(locator); RabbitHutch.SetContainerFactory(() => adapter); _externalMessageBus = RabbitHutch.CreateBus(connectionString, register => register.Register <IConsumerErrorStrategy, MyClass>()); _eventBus = locator.Resolve <Core.IEventBus>(); _commandHandlerFactory = locator.Resolve <ICommandHandlerFactory>(); var a = locator.Resolve <IConsumerErrorStrategy>(); }
/// <summary> Resolve by specifying a generic type. Throws exception if registration is absent </summary> public static TType ResolveRequire <TType>(this ILocator locator) where TType : class { var obj = locator.Resolve <TType>(); if (obj == null) { throw new NullReferenceException(String.Format("Type {0} is not registered", typeof(TType).Name)); } return(obj); }
/// <summary> Resolve by specifying a generic type. Returns null if registration is absent </summary> public static TType Resolve <TType>(this ILocator locator) where TType : class { return((TType)locator.Resolve(typeof(TType))); }
public virtual void GetInstance() { var instance = locator.Resolve <ILogger>(); instance.Should().NotBeNull("Instance should not be null"); }
public AggregateSubscriberConfigurationBuilder For(string aggregateRoot) { Contract.Requires(!string.IsNullOrEmpty(aggregateRoot), "AggregateRoot should not be null or empty"); return(new AggregateSubscriberConfigurationBuilder(this, _locator.Resolve <IEventHandlerFactory>(), aggregateRoot)); }
public object GetService(Type serviceType) { return(locator.IsRegistered(serviceType) ? locator.Resolve(serviceType) : null); }
public TService Resolve <TService>() where TService : class { return(_locator.Resolve <TService>()); }