Пример #1
0
 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>();
 }
Пример #2
0
        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>();
        }
Пример #3
0
        /// <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);
        }
Пример #4
0
 /// <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)));
 }
Пример #5
0
        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));
        }
Пример #7
0
 public object GetService(Type serviceType)
 {
     return(locator.IsRegistered(serviceType) ? locator.Resolve(serviceType) : null);
 }
Пример #8
0
 public TService Resolve <TService>() where TService : class
 {
     return(_locator.Resolve <TService>());
 }