io.lettuce.core.resource.ClientResources Java Examples
The following examples show how to use
io.lettuce.core.resource.ClientResources.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TraceRedisAutoConfiguration.java From spring-cloud-sleuth with Apache License 2.0 | 6 votes |
@Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (bean instanceof ClientResources) { ClientResources cr = (ClientResources) bean; if (!cr.tracing().isEnabled()) { if (log.isDebugEnabled()) { log.debug( "Lettuce ClientResources bean is auto-configured to enable tracing."); } BraveTracing lettuceTracing = BraveTracing.builder().tracing(tracing()) .excludeCommandArgsFromSpanTags() .serviceName(traceRedisProperties.getRemoteServiceName()).build(); return cr.mutate().tracing(lettuceTracing).build(); } if (log.isDebugEnabled()) { log.debug( "Lettuce ClientResources bean is skipped for auto-configuration because tracing was already enabled."); } } return bean; }
Example #2
Source File: RedisConfig.java From jeesupport with MIT License | 6 votes |
@Bean public LettucePoolingClientConfiguration lettucePoolConfig( ClientOptions _co, ClientResources _cr ){ GenericObjectPoolConfig gopc = new GenericObjectPoolConfig(); gopc.setMaxIdle( CommonConfig.getInteger( "spring.redis.pool.max-idle", DEFAULT_MAX_IDLE ) ); gopc.setMinIdle( CommonConfig.getInteger( "spring.redis.pool.min-idle", DEFAULT_MIN_IDLE ) ); gopc.setMaxTotal( CommonConfig.getInteger( "spring.redis.pool.max-active", DEFAULT_MAX_TOTAL ) ); gopc.setMaxWaitMillis( CommonConfig.getLong( "spring.redis.pool.max-wait", DEFAULT_MAX_WAIT_MILLIS ) ); gopc.setEvictorShutdownTimeoutMillis( CommonConfig.getLong( "spring.redis.pool.timeout", DEFAULT_EVICTOR_SHUTDOWN_TIMEOUT_MILLIS ) ); return LettucePoolingClientConfiguration.builder() .poolConfig( gopc ) .clientOptions( _co ) .clientResources( _cr ) .build(); }
Example #3
Source File: RedisRateLimiterConfiguration.java From daming with Apache License 2.0 | 6 votes |
@Bean @ConditionalOnMissingBean(value = RequestRateLimiterFactory.class) public RedisRateLimiterFactory redisRateLimiterFactory(ClientResources redisClientResources, RedisProperties redisProperties) { RedisURI.Builder builder = RedisURI.builder() .withHost(redisProperties.getHost()) .withPort(redisProperties.getPort()); if (!StringUtils.isEmpty(redisProperties.getPassword())) { builder = builder.withPassword(redisProperties.getPassword()); } if (null != redisProperties.getTimeout()) { builder = builder.withTimeout(redisProperties.getTimeout()); } builder = builder.withDatabase(redisProperties.getDatabase()) .withSsl(redisProperties.isSsl()); RedisURI redisUri = builder.build(); return new RedisRateLimiterFactory(RedisClient.create(redisClientResources, redisUri)); }
Example #4
Source File: LettuceConnFactoryProvider.java From sofa-dashboard-client with Apache License 2.0 | 5 votes |
private LettuceClientConfiguration getLettuceClientConfiguration(ClientResources clientResources, Pool pool) { LettuceClientConfigurationBuilder builder = createBuilder(pool); applyProperties(builder); if (StringUtils.hasText(this.properties.getUrl())) { customizeConfigurationFromUrl(builder); } builder.clientResources(clientResources); return builder.build(); }
Example #5
Source File: RedisPipeline.java From NetDiscovery with Apache License 2.0 | 5 votes |
public RedisPipeline(ClientResources resources, RedisURI redisURI, String key, long pipelineDelay) { super(pipelineDelay); if (null != resources) { this.redisClient = RedisClient.create(resources, redisURI); } else { this.redisClient = RedisClient.create(redisURI); } this.key = key; }
Example #6
Source File: LettuceRedisInitializer.java From spring-fu with Apache License 2.0 | 5 votes |
private LettuceConnectionFactory getLettuceConnectionFactory(GenericApplicationContext context) { final LettuceConnectionConfiguration configuration = new LettuceConnectionConfiguration(redisProperties, context.getBeanProvider(RedisSentinelConfiguration.class), context.getBeanProvider(RedisClusterConfiguration.class)); final ClientResources clientResources = DefaultClientResources.create(); try { return configuration.redisConnectionFactory(context.getBeanProvider(LettuceClientConfigurationBuilderCustomizer.class), clientResources); } catch (UnknownHostException e) { throw new IllegalStateException(e); } }
Example #7
Source File: LettuceConnFactoryProvider.java From sofa-dashboard-client with Apache License 2.0 | 5 votes |
public LettuceConnectionFactory createFactory(ClientResources clientResources) { LettuceClientConfiguration clientConfig = getLettuceClientConfiguration(clientResources, this.properties.getLettuce().getPool()); LettuceConnectionFactory factory = createLettuceConnectionFactory(clientConfig); factory.afterPropertiesSet(); return factory; }
Example #8
Source File: RedisQueue.java From NetDiscovery with Apache License 2.0 | 4 votes |
public RedisQueue(String host, ClientResources resources) { this(host,6379,resources); }
Example #9
Source File: RedisQueue.java From NetDiscovery with Apache License 2.0 | 4 votes |
public RedisQueue(String host, int port, ClientResources resources) { this(resources != null? RedisClient.create(resources, RedisURI.create(host, port)) : RedisClient.create(RedisURI.create(host, port))); }
Example #10
Source File: RedisPriorityQueue.java From NetDiscovery with Apache License 2.0 | 4 votes |
public RedisPriorityQueue(String host, ClientResources resources) { super(host, resources); }
Example #11
Source File: RedisPriorityQueue.java From NetDiscovery with Apache License 2.0 | 4 votes |
public RedisPriorityQueue(String host, int port,ClientResources resources) { super(host, port,resources); }
Example #12
Source File: MultiConnectionConfiguration.java From dew with Apache License 2.0 | 4 votes |
@Override public LettuceConnectionFactory redisConnectionFactory(ObjectProvider<LettuceClientConfigurationBuilderCustomizer> builderCustomizers, ClientResources clientResources) throws UnknownHostException { return super.redisConnectionFactory(builderCustomizers, clientResources); }
Example #13
Source File: TracingStatefulRedisConnection.java From java-redis-client with Apache License 2.0 | 4 votes |
@Override public ClientResources getResources() { return connection.getResources(); }
Example #14
Source File: TracingStatefulRedisClusterConnection.java From java-redis-client with Apache License 2.0 | 4 votes |
@Override public ClientResources getResources() { return connection.getResources(); }
Example #15
Source File: TracingStatefulRedisConnection.java From java-redis-client with Apache License 2.0 | 4 votes |
@Override public ClientResources getResources() { return connection.getResources(); }
Example #16
Source File: TracingStatefulRedisClusterConnection.java From java-redis-client with Apache License 2.0 | 4 votes |
@Override public ClientResources getResources() { return connection.getResources(); }
Example #17
Source File: RedisConfig.java From jeesupport with MIT License | 4 votes |
@Bean( destroyMethod = "shutdown" ) public ClientResources clientResources(){ return DefaultClientResources.create(); }
Example #18
Source File: RedisPipeline.java From NetDiscovery with Apache License 2.0 | 2 votes |
public RedisPipeline(ClientResources resources, RedisURI redisURI, String key) { this(resources,redisURI,key,0); }