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()
                           ));
            });
        }
Exemple #2
0
 public RedisProducerRegistryFactory(
     RedisMessagingGatewayConfiguration redisConfiguration,
     IEnumerable <RedisMessagePublication> publications)
 {
     _redisConfiguration = redisConfiguration;
     _publications       = publications;
 }
Exemple #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;
 }
Exemple #4
0
 public RedisMessageProducer(
     RedisMessagingGatewayConfiguration redisMessagingGatewayConfiguration, 
     RedisMessagePublication publication = null)
 
    : base(redisMessagingGatewayConfiguration)
 {
     _publication = publication ?? new RedisMessagePublication{MakeChannels = OnMissingChannel.Create};
     MaxOutStandingMessages = _publication.MaxOutStandingMessages;
     MaxOutStandingCheckIntervalMilliSeconds = _publication.MaxOutStandingCheckIntervalMilliSeconds;
 }
        public RedisMessageProducer(
            RedisMessagingGatewayConfiguration redisMessagingGatewayConfiguration,
            RedisMessagePublication publication)

            : base(redisMessagingGatewayConfiguration)
        {
            _publication           = publication;
            MaxOutStandingMessages = _publication.MaxOutStandingMessages;
            MaxOutStandingCheckIntervalMilliSeconds = _publication.MaxOutStandingCheckIntervalMilliSeconds;
        }
        protected RedisMessageGateway(RedisMessagingGatewayConfiguration redisMessagingGatewayConfiguration)
        {
            GatewayConfiguration = redisMessagingGatewayConfiguration;

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

                return(new RedisManagerPool(GatewayConfiguration.RedisConnectionString, new RedisPoolConfig()));
            });
        }
        public RedisMessageProducer(RedisMessagingGatewayConfiguration redisMessagingGatewayConfiguration)
        {
            _messageTimeToLive = redisMessagingGatewayConfiguration.MessageTimeToLive ?? TimeSpan.FromMinutes(10);

            _pool = new Lazy <RedisManagerPool>(() => new RedisManagerPool(
                                                    redisMessagingGatewayConfiguration.RedisConnectionString,
                                                    new RedisPoolConfig()
            {
                MaxPoolSize = redisMessagingGatewayConfiguration.MaxPoolSize
            }
                                                    ));
        }
Exemple #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
     }
                                                  ));
 }
Exemple #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);
             }
         }
     }
 }
Exemple #10
0
 public RedisMessageProducer(RedisMessagingGatewayConfiguration redisMessagingGatewayConfiguration, Publication publication = null)
     : base(redisMessagingGatewayConfiguration)
 {
     _publication = publication;
 }
Exemple #11
0
 public RedisMessageProducer(RedisMessagingGatewayConfiguration redisMessagingGatewayConfiguration)
     : this(redisMessagingGatewayConfiguration, new Publication {
     MakeChannels = OnMissingChannel.Create
 })
 {
 }
Exemple #12
0
 public RedisMessageProducer(RedisMessagingGatewayConfiguration redisMessagingGatewayConfiguration)
     : base(redisMessagingGatewayConfiguration)
 {
 }