Commit Graph

879 Commits

Author SHA1 Message Date
Christoph Strobl
630ff46b45 DATAREDIS-935 - Allow configuration of a single initial cache in RedisCacheManagerBuilder.
Also, add introspection methods to expose the configured cache names/configurations.

Original pull request: #387.
2019-02-27 15:19:19 +01:00
Mark Paluch
32cc2a60e7 DATAREDIS-932 - Fix typo in exception message. 2019-02-18 08:48:24 +01:00
Mark Paluch
2622f054ab DATAREDIS-930 - Polishing.
Add since tags. Simplify test using Lombok annotations. Reformat code.

Original pull request: #385.
2019-02-15 11:09:38 +01:00
Luis De Bello
34951495ba DATAREDIS-930 - Return port/host of WithHostAndPort configurations using LettuceConnectionFactory.getPort() and getHost().
We now correctly return host and port from configurations that implement WithHostAndPort instead of always using RedisStandaloneConfiguration.

Original pull request: #385.
2019-02-15 11:08:08 +01:00
Mark Paluch
ff9802ad3d DATAREDIS-923 - Updated changelog. 2019-02-13 11:48:00 +01:00
NFM
bc44cf61e8 DATAREDIS-915 - Fix RedisCacheManager example in reference documentation.
Original pull request: #380.
2019-02-07 15:01:10 +01:00
Mark Paluch
5cbf448b64 DATAREDIS-901 - Updated changelog. 2019-01-10 14:15:44 +01:00
Mark Paluch
e203f90f9c DATAREDIS-900 - Updated changelog. 2019-01-10 12:26:37 +01:00
Mark Paluch
e45a5a8df5 DATAREDIS-899 - Updated changelog. 2019-01-10 11:01:22 +01:00
Mark Paluch
62e48be873 DATAREDIS-918 - Enable Lettuce's global timeouts by default.
LettuceClientConfiguration now enables Lettuce's global timeouts by default to enable timeouts using the reactive API. This change prevents hanging Redis commands due to a blocked connection or when Redis is down. Timeouts are enabled through defaulting so setting ClientOptions or ClusterClientOptions overrides this behavior.

Original Pull Request: #381
2019-01-09 13:38:29 +01:00
Mark Paluch
f253d4128d DATAREDIS-749 - Polishing.
Upgrade to Jedis 3.0. Remove reflective sendCommand calls in favor of public Jedis sendCommand API. Invocations with null arguments by introducing overloads with argument defaulting. Fix exception translation because of a changed exception hierarchy. Fix tests and adapt tests to new transactional results that return null values instead if empty collections for nested array responses.

Reformat code. Add author tags. Add note to reference docs.

Original pull request: #374.
2019-01-08 09:37:34 +01:00
Guy Korland
f4680a180c DATAREDIS-749 - Upgrade to Jedis 3.0.0 M1.
Upgrade dependency version to 3.0.0 M1. Adapt to API changes.

Original pull request: #374.
2019-01-08 09:37:31 +01:00
Mark Paluch
3a07a0d8ed DATAREDIS-917 - Update copyright years to 2019. 2019-01-02 14:16:01 +01:00
Mark Paluch
7ec4641cc1 DATAREDIS-913 - Delete multiple keys through ReactiveRedisTemplate.delete(Publisher) and unlink(Publisher).
We now delete all keys that are emitted by the source publisher when invoking delete(Publisher) and unlink(Publisher). Both methods split incoming keys into chunks of 128 keys to keep a balance between latency and the issued command count.

Previously, delete(Publisher) and unlink(Publisher) only deleted the first key.

Original Pull Request: #379
2018-12-20 09:42:43 +01:00
Mark Paluch
d248c0cd7c DATAREDIS-909 - Fix constructor creation of entities with collection-typed properties.
We now consider the property type in value conversion for constructor arguments to provide the appropriate value type. Previously, we considered the component type which converted a Collection<T> to a single T that caused downstream ClassCastException.

Original Pull Request: #378
2018-12-20 08:54:12 +01:00
Mark Paluch
1f4bb973ea DATAREDIS-865 - Expose GenericJackson2JsonRedisSerializer.registerNullValueSerializer() for ObjectMapper customization.
We now expose registerNullValueSerializer(…) on GenericJackson2JsonRedisSerializer to allow customization of an externally provided ObjectMapper. NullValueSerializer was previously registered only within a constructor that takes classPropertyTypeName and provided no further possibilities to customize ObjectMapper.

Code wishing to provide a custom ObjectMapper can now call GenericJackson2JsonRedisSerializer.registerNullValueSerializer(objectMapper, …) and perform additional customizations before using ObjectMapper with GenericJackson2JsonRedisSerializer.

Original Pull Request: #376
2018-12-20 08:35:30 +01:00
Mark Paluch
ed79d14355 DATAREDIS-905 - Fix race condition in StreamMessageListenerContainer subscription activation.
Stream subscriptions now report reliably their state reflecting regarding activation, cancellation and while being active.

Previously, registering a subscription with immediate cancel could report an inactive subscription although StreamMessageListenerContainer could perform a stream read.

When activating a subscription in StreamMessageListenerContainer, awaiting activation (awaitStart(…)), immediately cancelling the subscription, and reading active state via Subscription.isActive(), Subscription.isActive() could report in this case false. This was because we checked that the status was either running or the stream read has reached event looping. The state was CANCELLED and the task thread had not yet reached the event loop and so there was a gap.

Original Pull Request: #377
2018-12-20 08:20:45 +01:00
Christoph Strobl
b6692b5956 DATAREDIS-906 - Prepare 2.2 M1 (Moore). 2018-12-11 10:53:11 +01:00
Christoph Strobl
02a6bd1cd0 DATAREDIS-906 - Updated changelog. 2018-12-11 10:53:10 +01:00
Mark Paluch
37789e6de3 DATAREDIS-907 - Simplify reference documentation setup. 2018-12-10 10:18:32 +01:00
chao chang
b510ef0606 DATAREDIS-903 - Remove Javadoc for unused RedisClusterConfiguration settings.
The following configuration keys which are not used in RedisClusterConfiguration, are removed from the Javadoc.
	 * spring.redis.cluster.timeout=5
	 * spring.redis.cluster.password=foobar

Original pull request: #375.
2018-12-06 08:46:59 +01:00
Christoph Strobl
c8bfc71678 DATAREDIS-721 - Polishing.
Original Pull Request: #315
2018-11-30 14:42:31 +01:00
Mark Paluch
b496aab2fb DATAREDIS-721 - Switch to non-blocking connect methods.
We now connect asynchronously to expose non-blocking connection behavior for reactive API usage. We also use a non-blocking, asynchronous pool implementation for connections that are used through a reactive API. Shared connection usage, which is blocking on the very first access can be pre-initialized during connection factory initialization instead of initialization on first access:

LettuceConnectionFactory connectionFactory = new LettuceConnectionFactory();
connectionFactory.setEagerInitialization(true);
connectionFactory.afterPropertiesSet();

We no longer require offloading of blocking connects to a dedicated scheduler which makes reactive API usage fully non-blocking.

Original Pull Request: #315
2018-11-30 12:54:12 +01:00
Mark Paluch
f3ec8782cd DATAREDIS-885 - Updated changelog. 2018-11-27 14:54:09 +01:00
Mark Paluch
0db274b381 DATAREDIS-879 - Updated changelog. 2018-11-27 12:36:49 +01:00
Mark Paluch
783565ab8d DATAREDIS-880 - Updated changelog. 2018-11-27 11:27:24 +01:00
Mark Paluch
b440dc1f1f DATAREDIS-873 - Polishing.
Add since tags. Add tests. Reformat code. Update docs.

Original pull request: #361.
2018-11-23 12:01:56 +01:00
Dominys
724579b8a9 DATAREDIS-873 - Accept single collection parameter in SetOperations diff/inter/union methods.
We now accept a single collection parameter containing keys for diff/inter/union and their …store methods. Note that diff requires a specific key order to denote the initial set to compare to.

Original pull request: #361.
2018-11-23 12:01:46 +01:00
Mark Paluch
6921ab01bf DATAREDIS-890 - Polishing.
Add author tags. Use try-with-resources to close Jedis.

Original pull request: #373.
2018-11-23 10:18:00 +01:00
ChenGuanqun
9d47c48e22 DATAREDIS-890 - Randomize Redis Cluster node order before topology retrieval.
We now shuffle the set of Redis Cluster nodes before retrieving the topology. This change reduces load on the first node in the known nodes set.

Original pull request: #373.
2018-11-23 10:18:00 +01:00
Christoph Strobl
dc0ce19cd0 DATAREDIS-864 - Polishing.
Update Javadoc, remove unused code and fix some warnings.

Original Pull Request: #356
2018-11-22 10:50:09 +01:00
Mark Paluch
8858e0f1be DATAREDIS-864 - Leave XREAD COUNT unconfigured if not configured through builder.
XREAD does no longer apply a COUNT if the count was left unconfigured on StreamReadOperationsBuilder. This removes the limitation of batch size 1 and allows generally an increased throughput in default configuration.

Original Pull Request: #356
2018-11-22 10:49:27 +01:00
Mark Paluch
eafcb331d8 DATAREDIS-864 - Polishing.
Exract nested Stream types into connection.stream package. Extract common code from Template-API based toObjectRecord handling into StreamObjectMapper.

StreamReceiver and StreamMessageListenerContainer now can emit MapRecord or ObjectRecord for easier consumption of stream records.

Original Pull Request: #356
2018-11-22 10:49:06 +01:00
Christoph Strobl
13648d7c85 DATAREDIS-864 - Allow simple types to be added to Redis Stream.
Move API so the stream is more like the hash having dedicated serializers for fields and their values. Also allow appending simple types such as string directly to a stream without having to go through creating a Map. Those simple types can also be read back.
Provide means to hash complex objects when added to the stream.

Update Documentation.

Original Pull Request: #356
2018-11-22 10:48:16 +01:00
Mark Paluch
65754623f6 DATAREDIS-864 - Add support for Redis Streams.
We now support Redis Streams to add, read and consume stream records. We introduced StreamOperations, BoundStreamOperations, and ReactiveStreamOperations to interact with Redis Streams using imperative and reactive programming models. Record represents items within a stream. There are various flavors of Stream Records:

* MapRecord (maps to the hash body used in stream messages).
* Binary MapRecord: byte[] and ByteBuffer variants of MapRecord.
* ObjectRecord: Simple and Complex Objects mapped onto the stream body hash using ObjectHashMapper.

Redis Streams are supported for the Lettuce client only as Jedis has not received yet Redis Stream support.

Messages can be created as Map or as object:

redisTemplate.opsForStream().add("my-stream", Collections.singletonMap("key", "value"));

redisTemplate.opsForStream().add(ObjectRecord.create("my-logins", new LoginEvent(…)));

Streams can be consumed by using a StreamMessageListenerContainer that allows for stream subscriptions or a StreamReceiver.

Synchronous Message Listener:

StreamMessageListenerContainer<String, MapRecord<String, String, String>> container = StreamMessageListenerContainer
      .create(connectionFactory);
container.start();

Subscription subscription = container.receive(StreamOffset.fromStart("my-stream"), record -> … );

Reactive Message Receiver:

StreamReceiverOptions<String, ObjectRecord<String, LoginEvent>> receiverOptions = StreamReceiverOptions.builder()
      .targetType(LoginEvent.class).build();

StreamReceiver<String, ObjectRecord<String, LoginEvent>> receiver = StreamReceiver.create(connectionFactory, receiverOptions);

Flux<ObjectRecord<String, LoginEvent>> messages = receiver.receive(StreamOffset.fromStart("my-logins"));

Original Pull Request: #356
2018-11-22 10:46:21 +01:00
Mark Paluch
f2544a253a DATAREDIS-878 - Updated changelog. 2018-10-29 14:30:35 +01:00
Mark Paluch
910e34067b DATAREDIS-875 - Polishing.
Reformat code.

Original pull request: #368.
2018-10-25 14:54:31 +02:00
Christoph Strobl
713a12bce9 DATAREDIS-875 - Omit MappingRedisConverter type hint for primitive type properties.
We now additionally check if the target property is a primitive type and do no longer add the type hint if so.

Original pull request: #368.
2018-10-25 14:53:34 +02:00
Mark Paluch
acd8b6bd4a DATAREDIS-872 - Polishing.
Create unit tests for RedisAtomic counter initialization. Refactor setIfAbsent(…) method to initializeIfAbsent() to not expose additional API methods.

Original pull request: #367.
2018-10-19 12:30:03 +02:00
ningwei
2d4fbc9aa0 DATAREDIS-872 - Fix race condition in RedisAtomic counters initialization.
We now use setIfAbsent to initialize RedisAtomic counters if no initial value was given. Using setIfAbsent turns the initialization into a single atomic step that prevents race conditions of the previously check and set method that required two Redis commands.

Previously, concurrent processes (threads, external changes to Redis) could set the initial value between the existence check and the value set operation that caused the last participant to win.

Original pull request: #367.
2018-10-19 12:27:33 +02:00
Mark Paluch
6132799353 DATAREDIS-881 - Polishing.
Add author tags. Reformat code. Javadoc, add tests.

Original pull request: #363.
2018-10-16 15:02:42 +02:00
Yanming Zhou
8e8861cbcd DATAREDIS-881 - Allow configuration of Lettuce's quiet shutdown period.
LettuceClientConfigurationBuilder now allows configuration of the quiet shutdown period to improve shutdown time of the Netty EventLoop when using non-shared ClientResources.

Original pull request: #363.
2018-10-16 15:00:32 +02:00
Mark Paluch
148b1ae582 DATAREDIS-874 - Polishing.
Reformat code. Add since tags. Extend tests.

Align Javadoc tonality across RedisAtomic… types.

Original pull request: #362.
2018-10-16 12:08:07 +02:00
Graham MacMaster
f2107ef81b DATAREDIS-874 - Implement accumulate/update methods on RedisAtomic[*] classes.
This commit adds the following public methods to RedisAtomicInteger,
RedisAtomicLong, and RedisAtomicDouble:

T accumulateAndGet(T updateValue, BinaryOperator<T> accumulatorFunction);
T getAndAccumulate(T updateValue, BinaryOperator<T> accumulatorFunction);
T updateAndGet(UnaryOperator<T> updateFunction);
T getAndUpdate(UnaryOperator<T> updateFunction);

These methods are primarily useful for doing CAS operations with the
help of Binary/UnaryOperators to generate the new value. They mirror
their counterparts on the AtomicInteger and AtomicLong classes
available in the java.util.concurrent.atomic package.

Original pull request: #362.
2018-10-16 12:08:07 +02:00
Mark Paluch
7ab8ade8d3 DATAREDIS-866 - Updated changelog. 2018-10-15 14:30:21 +02:00
Mark Paluch
d1066fb591 DATAREDIS-871 - Updated changelog. 2018-10-15 11:37:26 +02:00
Mark Paluch
426bd11bef DATAREDIS-861 - Prepare 2.1 GA (Lovelace). 2018-09-21 07:07:51 -04:00
Mark Paluch
f3e7995ec4 DATAREDIS-861 - Updated changelog. 2018-09-21 07:07:49 -04:00
Christoph Strobl
45cbb21849 DATAREDIS-869 - Polishing.
Rename parameters and add methods with new nomenclature.

Original Pull Request: #355
2018-09-20 10:49:20 +02:00
Mark Paluch
169b1bd174 DATAREDIS-869 - Adapt to nomenclature change about Master/Replica.
We now renamed RedisStaticMasterSlaveConfiguration and StaticMasterSlaveConnectionProvider to RedisStaticMasterReplicaConfiguration respective StaticMasterReplicaConnectionProvider to reflect changes in Redis nomenclature regarding replication.

Original Pull Request: #355
2018-09-20 10:48:46 +02:00