예제 #1
0
        public RedisRemoteEventPublisher(IRedisSetting redisSetting, IRemoteEventSerializer remoteEventSerializer)
        {
            Check.NotNullOrWhiteSpace(redisSetting.Server, "redisSetting.Server");

            _remoteEventSerializer = remoteEventSerializer;

            _connectionMultiplexer = ConnectionMultiplexer.Connect(redisSetting.Server);
            _database = _connectionMultiplexer.GetDatabase(redisSetting.DatabaseId);
        }
예제 #2
0
        public RedisRemoteEventSubscriber(IRedisSetting redisSetting)
        {
            Check.NotNullOrWhiteSpace(redisSetting.Server, "redisSetting.Server");

            _connectionMultiplexer = ConnectionMultiplexer.Connect(redisSetting.Server);
            _database   = _connectionMultiplexer.GetDatabase(redisSetting.DatabaseId);
            _subscriber = _database.Multiplexer.GetSubscriber();

            _dictionary = new List <string>();

            Logger = NullLogger.Instance;
        }
        public IRedisConfiguration Configure(IRedisSetting setting)
        {
            _configuration.IocManager.IocContainer.Register(
                Component.For <IRemoteEventPublisher>()
                .ImplementedBy <RedisRemoteEventPublisher>()
                .DependsOn(Castle.MicroKernel.Registration.Dependency.OnValue <IRedisSetting>(setting))
                .Named(Guid.NewGuid().ToString())
                .LifestyleSingleton()
                .IsDefault()
                );

            _configuration.IocManager.IocContainer.Register(
                Component.For <IRemoteEventSubscriber>()
                .ImplementedBy <RedisRemoteEventSubscriber>()
                .DependsOn(Castle.MicroKernel.Registration.Dependency.OnValue <IRedisSetting>(setting))
                .Named(Guid.NewGuid().ToString())
                .LifestyleSingleton()
                .IsDefault()
                );

            return(this);
        }