protected RedisMessageGateway(RedisMessagingGatewayConfiguration redisMessagingGatewayConfiguration)
        {
            _messageTimeToLive = redisMessagingGatewayConfiguration.MessageTimeToLive ?? TimeSpan.FromMinutes(10);

            Pool = new Lazy <RedisManagerPool>(() =>
            {
                RedisConfig.DefaultConnectTimeout = 1 * 1000;
                RedisConfig.DefaultSendTimeout    = 1 * 1000;
                RedisConfig.DefaultReceiveTimeout = 1 * 1000;
                if (redisMessagingGatewayConfiguration.DefaultRetryTimeout.HasValue)
                {
                    RedisConfig.DefaultRetryTimeout = redisMessagingGatewayConfiguration.DefaultRetryTimeout.Value;
                }
                RedisConfig.DefaultIdleTimeOutSecs = 240;
                if (redisMessagingGatewayConfiguration.BackoffMultiplier.HasValue)
                {
                    RedisConfig.BackOffMultiplier = redisMessagingGatewayConfiguration.BackoffMultiplier.Value;
                }
                RedisConfig.BufferLength = 1450;
                if (redisMessagingGatewayConfiguration.MaxPoolSize.HasValue)
                {
                    RedisConfig.DefaultMaxPoolSize = redisMessagingGatewayConfiguration.MaxPoolSize;
                }
                RedisConfig.VerifyMasterConnections  = true;
                RedisConfig.HostLookupTimeoutMs      = 1000;
                RedisConfig.DeactivatedClientsExpiry = TimeSpan.FromSeconds(15);
                RedisConfig.DisableVerboseLogging    = false;

                return(new RedisManagerPool(
                           redisMessagingGatewayConfiguration.RedisConnectionString,
                           new RedisPoolConfig()
                           ));
            });
        }
Пример #2
0
 public RedisProducerRegistryFactory(
     RedisMessagingGatewayConfiguration redisConfiguration,
     IEnumerable <RedisMessagePublication> publications)
 {
     _redisConfiguration = redisConfiguration;
     _publications       = publications;
 }
Пример #3
0
 /// <summary>
 /// Creates a consumer that reads from a List in Redis via a BLPOP (so will block).
 /// </summary>
 /// <param name="redisMessagingGatewayConfiguration">Configuration for our Redis cient etc.</param>
 /// <param name="queueName">Key of the list in Redis we want to read from</param>
 /// <param name="topic">The topic that the list subscribes to</param>
 public RedisMessageConsumer(
     RedisMessagingGatewayConfiguration redisMessagingGatewayConfiguration,
     string queueName,
     string topic)
     : base(redisMessagingGatewayConfiguration)
 {
     _queueName = queueName;
     Topic      = topic;
 }
Пример #4
0
 public RedisMessageProducer(
     RedisMessagingGatewayConfiguration redisMessagingGatewayConfiguration, 
     RedisMessagePublication publication = null)
 
    : base(redisMessagingGatewayConfiguration)
 {
     _publication = publication ?? new RedisMessagePublication{MakeChannels = OnMissingChannel.Create};
     MaxOutStandingMessages = _publication.MaxOutStandingMessages;
     MaxOutStandingCheckIntervalMilliSeconds = _publication.MaxOutStandingCheckIntervalMilliSeconds;
 }
Пример #5
0
        public RedisMessageProducer(
            RedisMessagingGatewayConfiguration redisMessagingGatewayConfiguration,
            RedisMessagePublication publication)

            : base(redisMessagingGatewayConfiguration)
        {
            _publication           = publication;
            MaxOutStandingMessages = _publication.MaxOutStandingMessages;
            MaxOutStandingCheckIntervalMilliSeconds = _publication.MaxOutStandingCheckIntervalMilliSeconds;
        }
Пример #6
0
        protected RedisMessageGateway(RedisMessagingGatewayConfiguration redisMessagingGatewayConfiguration)
        {
            GatewayConfiguration = redisMessagingGatewayConfiguration;

            Pool = new Lazy <RedisManagerPool>(() =>
            {
                OverrideRedisClientDefaults();

                return(new RedisManagerPool(GatewayConfiguration.RedisConnectionString, new RedisPoolConfig()));
            });
        }
Пример #7
0
        public RedisMessageProducer(RedisMessagingGatewayConfiguration redisMessagingGatewayConfiguration)
        {
            _messageTimeToLive = redisMessagingGatewayConfiguration.MessageTimeToLive ?? TimeSpan.FromMinutes(10);

            _pool = new Lazy <RedisManagerPool>(() => new RedisManagerPool(
                                                    redisMessagingGatewayConfiguration.RedisConnectionString,
                                                    new RedisPoolConfig()
            {
                MaxPoolSize = redisMessagingGatewayConfiguration.MaxPoolSize
            }
                                                    ));
        }
Пример #8
0
 /// <summary>
 /// Creates a consumer that reads from a List in Redis via a BLPOP (so will block).
 /// </summary>
 /// <param name="redisMessagingGatewayConfiguration">Configuration for our Redis cient etc.</param>
 /// <param name="queueName">Key of the list in Redis we want to read from</param>
 /// <param name="topic">The topic that the list subscribes to</param>
 public RedisMessageConsumer(
     RedisMessagingGatewayConfiguration redisMessagingGatewayConfiguration,
     string queueName,
     string topic)
 {
     _queueName = queueName;
     _topic     = topic;
     _pool      = new Lazy <RedisManagerPool>(() => new RedisManagerPool(
                                                  redisMessagingGatewayConfiguration.RedisConnectionString,
                                                  new RedisPoolConfig()
     {
         MaxPoolSize = redisMessagingGatewayConfiguration.MaxPoolSize
     }
                                                  ));
 }
Пример #9
0
 public RedisMessageProducer(RedisMessagingGatewayConfiguration configuration)
 {
     //We don't want to recreate this each time, so use a static instance
     if (_redis == null)
     {
         lock (SyncRoot)
         {
             if (_redis == null)
             {
                 var options = ConfigurationOptions.Parse(configuration.ServerList);
                 options.AllowAdmin     = configuration.AllowAdmin;
                 options.ConnectRetry   = configuration.ConnectRetry;
                 options.ConnectTimeout = configuration.ConnectTimeout;
                 options.SyncTimeout    = configuration.SyncTimeout;
                 options.Proxy          = configuration.Proxy;
                 _redis = ConnectionMultiplexer.Connect(options);
             }
         }
     }
 }
Пример #10
0
 public RedisMessageProducer(RedisMessagingGatewayConfiguration redisMessagingGatewayConfiguration, Publication publication = null)
     : base(redisMessagingGatewayConfiguration)
 {
     _publication = publication;
 }
Пример #11
0
 public RedisMessageProducer(RedisMessagingGatewayConfiguration redisMessagingGatewayConfiguration)
     : this(redisMessagingGatewayConfiguration, new Publication {
     MakeChannels = OnMissingChannel.Create
 })
 {
 }
Пример #12
0
 public RedisMessageProducer(RedisMessagingGatewayConfiguration redisMessagingGatewayConfiguration)
     : base(redisMessagingGatewayConfiguration)
 {
 }