com.netflix.dyno.jedis.DynoJedisClient Java Examples
The following examples show how to use
com.netflix.dyno.jedis.DynoJedisClient.
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: DynomiteJedisProvider.java From conductor with Apache License 2.0 | 6 votes |
@Override public JedisCommands get() { ConnectionPoolConfigurationImpl connectionPoolConfiguration = new ConnectionPoolConfigurationImpl(configuration.getClusterName()) .withTokenSupplier(tokenMapSupplier) .setLocalRack(configuration.getAvailabilityZone()) .setLocalDataCenter(configuration.getRegion()) .setSocketTimeout(0) .setConnectTimeout(0) .setMaxConnsPerHost( configuration.getMaxConnectionsPerHost() ); return new DynoJedisClient.Builder() .withHostSupplier(hostSupplier) .withApplicationName(configuration.getAppId()) .withDynomiteClusterName(configuration.getClusterName()) .withCPConfig(connectionPoolConfiguration) .build(); }
Example #2
Source File: DynoJedisDemo.java From dyno with Apache License 2.0 | 6 votes |
public void initDualWriterDemo(HostSupplier primaryClusterHostSupplier, HostSupplier shadowClusterHostSupplier, TokenMapSupplier primaryTokenSupplier, TokenMapSupplier shadowTokenSupplier) { this.client = new DynoJedisClient.Builder() .withApplicationName("demo") .withDynomiteClusterName("dyno-dev") .withHostSupplier(primaryClusterHostSupplier) .withDualWriteHostSupplier(shadowClusterHostSupplier) .withTokenMapSupplier(primaryTokenSupplier) .withDualWriteTokenMapSupplier(shadowTokenSupplier) .build(); ConnectionPoolConfigurationImpl shadowCPConfig = new ArchaiusConnectionPoolConfiguration(shadowClusterName); this.shadowClusterClient = new DynoJedisClient.Builder() .withApplicationName("demo") .withDynomiteClusterName("dyno-dev") .withHostSupplier(shadowClusterHostSupplier) .withTokenMapSupplier(shadowTokenSupplier) .withCPConfig(shadowCPConfig) .build(); }
Example #3
Source File: DynoProxy.java From conductor with Apache License 2.0 | 5 votes |
/** * @deprecated The preferred method of construction for this use case is via DynoProxyDiscoveryProvider. */ @Deprecated public DynoProxy(DiscoveryClient discoveryClient, Configuration config) throws DynoException, InterruptedException, ExecutionException { this.discoveryClient = discoveryClient; String cluster = config.getProperty("workflow.dynomite.cluster", null); String applicationName = config.getAppId(); this.dynoClient = new DynoJedisClient.Builder() .withApplicationName(applicationName) .withDynomiteClusterName(cluster) .withDiscoveryClient(discoveryClient) .build(); }
Example #4
Source File: DynoProxyDiscoveryProvider.java From conductor with Apache License 2.0 | 5 votes |
@Override public JedisCommands get() { return new DynoJedisClient .Builder() .withApplicationName(configuration.getAppId()) .withDynomiteClusterName(configuration.getCluster()) .withDiscoveryClient(discoveryClient) .build(); }
Example #5
Source File: DynoJedisDemo.java From dyno with Apache License 2.0 | 5 votes |
public void init(HostSupplier hostSupplier, int port, TokenMapSupplier tokenSupplier) throws Exception { client = new DynoJedisClient.Builder().withApplicationName("demo").withDynomiteClusterName("dyno_dev") .withHostSupplier(hostSupplier) .withTokenMapSupplier(tokenSupplier) // .withCPConfig( // new ConnectionPoolConfigurationImpl("demo") // .setCompressionStrategy(ConnectionPoolConfiguration.CompressionStrategy.THRESHOLD) // .setCompressionThreshold(2048) // .setLocalRack(this.localRack) // ) .build(); }
Example #6
Source File: DynoQueueDAO.java From conductor with Apache License 2.0 | 4 votes |
@Deprecated public DynoQueueDAO(DiscoveryClient dc, Configuration config) { logger.info("DynoQueueDAO::INIT"); this.config = config; this.domain = config.getProperty("workflow.dyno.keyspace.domain", null); String cluster = config.getProperty("workflow.dynomite.cluster", null); final int readConnPort = config.getIntProperty("queues.dynomite.nonQuorum.port", 22122); EurekaHostsSupplier hostSupplier = new EurekaHostsSupplier(cluster, dc) { @Override public List<Host> getHosts() { List<Host> hosts = super.getHosts(); List<Host> updatedHosts = new ArrayList<>(hosts.size()); hosts.forEach(host -> updatedHosts.add( new HostBuilder() .setHostname(host.getHostName()) .setIpAddress(host.getIpAddress()) .setPort(readConnPort) .setRack(host.getRack()) .setDatacenter(host.getDatacenter()) .setStatus(host.isUp() ? Host.Status.Up : Host.Status.Down) .createHost() )); return updatedHosts; } }; this.dynoClientRead = new DynoJedisClient.Builder() .withApplicationName(config.getAppId()) .withDynomiteClusterName(cluster) .withHostSupplier(hostSupplier) .withConnectionPoolConsistency("DC_ONE") .build(); DynoJedisClient dyno = new DynoJedisClient.Builder() .withApplicationName(config.getAppId()) .withDynomiteClusterName(cluster) .withDiscoveryClient(dc) .build(); this.dynoClient = dyno; String region = config.getRegion(); String localDC = config.getAvailabilityZone(); if (localDC == null) { throw new Error("Availability zone is not defined. Ensure Configuration.getAvailabilityZone() returns a non-null and non-empty value."); } localDC = localDC.replaceAll(region, ""); this.ss = new DynoShardSupplier(dyno.getConnPool().getConfiguration().getHostSupplier(), region, localDC); init(); }
Example #7
Source File: DynoJedisJsonClient.java From dyno with Apache License 2.0 | 4 votes |
public DynoJedisJsonClient(DynoJedisClient client) { this.client = client; }
Example #8
Source File: DynoJedisPipelineCounter.java From dyno with Apache License 2.0 | 4 votes |
public DynoJedisPipelineCounter(String key, DynoJedisClient client) { super(key, client); this.consumer = new Consumer(queue, generatedKeys); }
Example #9
Source File: DynoJedisBatchCounter.java From dyno with Apache License 2.0 | 4 votes |
public DynoJedisBatchCounter(String key, DynoJedisClient client, Long frequencyInMillis) { this.counter.compareAndSet(null, new DynoJedisCounter(key, client)); this.localCounter = new AtomicLong(0L); this.frequencyInMillis = frequencyInMillis; }
Example #10
Source File: DynoJedisCounter.java From dyno with Apache License 2.0 | 4 votes |
public DynoJedisCounter(String key, DynoJedisClient client) { this.key = key; this.client = client; this.generatedKeys = generateKeys(); }