Example #1
0
 public SpeedDataRedis(IMqRedis redis)
 {
     _redis = redis;
 }
Example #2
0
 public ReadOnlyUserRedis(IMqRedis redis)
 {
     _redis = redis;
 }
Example #3
0
 public WsServerNodeRedis(IMqRedis redis) : base(redis)
 {
 }
Example #4
0
 public CaptchaRedis(IMqRedis redis)
 {
     _redis = redis;
 }
Example #5
0
        /// <summary>
        /// 内部完成redis连接的创建和mq交换器、队列的声明以及mq消费者的启动,队列和交换器的绑定由启动的消费者负责。
        /// (mq消费者的启动是异步的,不会立即启动,而是在满足了后续的条件后才会启动)。
        /// </summary>
        /// <param name="serverAppType"></param>
        /// <param name="mqMessagePaths"></param>
        /// <returns></returns>
        public static bool Create(ServerAppType serverAppType, AbstractMqMessagePath[] mqMessagePaths, out IMqRedis serverConfig)
        {
            serverConfig = null;
            ConnectionMultiplexer redisConn;

            try {
                redisConn = ConnectionMultiplexer.Connect(ServerRoot.HostConfig.RedisConfig);
            }
            catch (Exception e) {
                NTMinerConsole.UserError("连接redis失败");
                Logger.ErrorDebugLine(e);
                return(false);
            }
            IConnection mqConn;

            try {
                var factory = new ConnectionFactory {
                    HostName = ServerRoot.HostConfig.MqHostName,
                    UserName = ServerRoot.HostConfig.MqUserName,
                    Password = ServerRoot.HostConfig.MqPassword,
                    AutomaticRecoveryEnabled = true, // 默认值也是true,复述一遍起文档作用
                    TopologyRecoveryEnabled  = true  // 默认值也是true,复述一遍起文档作用
                };
                mqConn = factory.CreateConnection(clientProvidedName: serverAppType.GetName());
            }
            catch (Exception e) {
                NTMinerConsole.UserError("连接Mq失败");
                Logger.ErrorDebugLine(e);
                return(false);
            }
            IModel channel = mqConn.CreateModel();

            channel.ExchangeDeclare(MqKeyword.NTMinerExchange, ExchangeType.Direct, durable: true, autoDelete: false, arguments: null);

            StartConsumer(channel, mqMessagePaths);

            serverConfig = new MqRedis(redisConn, channel);
            return(true);
        }
Example #6
0
 public UserMqSender(IMqRedis mq)
 {
     _mq = mq;
 }
Example #7
0
 public MinerRedis(IMqRedis redis) : base(redis)
 {
 }
Example #8
0
 public UserRedis(IMqRedis redis) : base(redis)
 {
 }
Example #9
0
 public ReadOnlyWsServerNodeRedis(IMqRedis redis)
 {
     _redis = redis;
 }
Example #10
0
 public MinerClientMqSender(IMqRedis mq)
 {
     _mq = mq;
 }
Example #11
0
 public OperationMqSender(IMqRedis mq)
 {
     _mq = mq;
 }
Example #12
0
 public WsServerNodeMqSender(IMqRedis serverConnection)
 {
     _serverConnection = serverConnection;
 }