#291 - Upgraded to Spring Boot 1.5.6.
Upgraded to Boot 1.5.6. Updated dependencies of reactive projects to latest versions to make sure the APIs of Boot work with the changes in Spring Data Kay RC1. Upgraded all other dependencies to match and got both the Redis and the Cassandra examples to compile again. Disabled Cassandra reactive samples for now as they fail at runtime.
This commit is contained in:
@@ -20,7 +20,7 @@
|
|||||||
<module>util</module>
|
<module>util</module>
|
||||||
<module>example</module>
|
<module>example</module>
|
||||||
<module>java8</module>
|
<module>java8</module>
|
||||||
<module>reactive</module>
|
<!--<module>reactive</module>-->
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|||||||
@@ -12,11 +12,11 @@
|
|||||||
<name>Spring Data Cassandra - Reactive features</name>
|
<name>Spring Data Cassandra - Reactive features</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<spring-data-releasetrain.version>Kay-M1</spring-data-releasetrain.version>
|
<spring-data-releasetrain.version>Kay-RC2</spring-data-releasetrain.version>
|
||||||
<spring.version>5.0.0.M3</spring.version>
|
<spring.version>5.0.0.RC3</spring.version>
|
||||||
<reactor.version>3.0.3.RELEASE</reactor.version>
|
<reactor.version>3.1.0.M3</reactor.version>
|
||||||
<rxjava.version>1.2.1</rxjava.version>
|
<rxjava.version>2.1.3</rxjava.version>
|
||||||
<rxjava-reactive-streams.version>1.2.0</rxjava-reactive-streams.version>
|
<rxjava-reactive-streams.version>1.2.1</rxjava-reactive-streams.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -26,11 +26,6 @@
|
|||||||
<artifactId>spring-data-commons</artifactId>
|
<artifactId>spring-data-commons</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.data</groupId>
|
|
||||||
<artifactId>spring-cql</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.data</groupId>
|
<groupId>org.springframework.data</groupId>
|
||||||
<artifactId>spring-data-cassandra</artifactId>
|
<artifactId>spring-data-cassandra</artifactId>
|
||||||
@@ -42,7 +37,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.reactivex</groupId>
|
<groupId>io.reactivex.rxjava2</groupId>
|
||||||
<artifactId>rxjava</artifactId>
|
<artifactId>rxjava</artifactId>
|
||||||
<version>${rxjava.version}</version>
|
<version>${rxjava.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 the original author or authors.
|
* Copyright 2016-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -16,8 +16,8 @@
|
|||||||
package example.springdata.cassandra.people;
|
package example.springdata.cassandra.people;
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.data.cassandra.config.AbstractReactiveCassandraConfiguration;
|
||||||
import org.springframework.data.cassandra.config.SchemaAction;
|
import org.springframework.data.cassandra.config.SchemaAction;
|
||||||
import org.springframework.data.cassandra.config.java.AbstractReactiveCassandraConfiguration;
|
|
||||||
import org.springframework.data.cassandra.repository.config.EnableReactiveCassandraRepositories;
|
import org.springframework.data.cassandra.repository.config.EnableReactiveCassandraRepositories;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 the original author or authors.
|
* Copyright 2016-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -19,9 +19,9 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import org.springframework.cassandra.core.PrimaryKeyType;
|
import org.springframework.data.cassandra.core.cql.PrimaryKeyType;
|
||||||
import org.springframework.data.cassandra.mapping.PrimaryKeyColumn;
|
import org.springframework.data.cassandra.core.mapping.PrimaryKeyColumn;
|
||||||
import org.springframework.data.cassandra.mapping.Table;
|
import org.springframework.data.cassandra.core.mapping.Table;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An entity to represent a Person.
|
* An entity to represent a Person.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 the original author or authors.
|
* Copyright 2016-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -15,18 +15,18 @@
|
|||||||
*/
|
*/
|
||||||
package example.springdata.cassandra.people;
|
package example.springdata.cassandra.people;
|
||||||
|
|
||||||
import rx.Observable;
|
import io.reactivex.Observable;
|
||||||
import rx.Single;
|
import io.reactivex.Single;
|
||||||
|
|
||||||
import org.springframework.data.cassandra.repository.Query;
|
import org.springframework.data.cassandra.repository.Query;
|
||||||
import org.springframework.data.repository.reactive.RxJava1CrudRepository;
|
import org.springframework.data.repository.reactive.RxJava2CrudRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Repository interface to manage {@link Person} instances.
|
* Repository interface to manage {@link Person} instances.
|
||||||
*
|
*
|
||||||
* @author Mark Paluch
|
* @author Mark Paluch
|
||||||
*/
|
*/
|
||||||
public interface RxJava1PersonRepository extends RxJava1CrudRepository<Person, String> {
|
public interface RxJava2PersonRepository extends RxJava2CrudRepository<Person, String> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Derived query selecting by {@code lastname}.
|
* Derived query selecting by {@code lastname}.
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 the original author or authors.
|
* Copyright 2016-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -77,7 +77,7 @@ public class ReactiveCassandraTemplateIntegrationTest {
|
|||||||
.last() //
|
.last() //
|
||||||
.flatMap(v -> template.count(Person.class)) //
|
.flatMap(v -> template.count(Person.class)) //
|
||||||
.doOnNext(System.out::println) //
|
.doOnNext(System.out::println) //
|
||||||
.doOnComplete(countDownLatch::countDown) //
|
.doOnSuccess(it -> countDownLatch.countDown()) //
|
||||||
.doOnError(throwable -> countDownLatch.countDown()) //
|
.doOnError(throwable -> countDownLatch.countDown()) //
|
||||||
.subscribe();
|
.subscribe();
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 the original author or authors.
|
* Copyright 2016-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -52,7 +52,7 @@ public class ReactivePersonRepositoryIntegrationTest {
|
|||||||
public void setUp() {
|
public void setUp() {
|
||||||
|
|
||||||
repository.deleteAll() //
|
repository.deleteAll() //
|
||||||
.thenMany(repository.save(Flux.just(new Person("Walter", "White", 50), //
|
.thenMany(repository.saveAll(Flux.just(new Person("Walter", "White", 50), //
|
||||||
new Person("Skyler", "White", 45), //
|
new Person("Skyler", "White", 45), //
|
||||||
new Person("Saul", "Goodman", 42), //
|
new Person("Saul", "Goodman", 42), //
|
||||||
new Person("Jesse", "Pinkman", 27))))
|
new Person("Jesse", "Pinkman", 27))))
|
||||||
@@ -70,12 +70,12 @@ public class ReactivePersonRepositoryIntegrationTest {
|
|||||||
|
|
||||||
repository.count() //
|
repository.count() //
|
||||||
.doOnNext(System.out::println) //
|
.doOnNext(System.out::println) //
|
||||||
.thenMany(repository.save(Flux.just(new Person("Hank", "Schrader", 43), //
|
.thenMany(repository.saveAll(Flux.just(new Person("Hank", "Schrader", 43), //
|
||||||
new Person("Mike", "Ehrmantraut", 62)))) //
|
new Person("Mike", "Ehrmantraut", 62)))) //
|
||||||
.last() //
|
.last() //
|
||||||
.flatMap(v -> repository.count()) //
|
.flatMap(v -> repository.count()) //
|
||||||
.doOnNext(System.out::println) //
|
.doOnNext(System.out::println) //
|
||||||
.doOnComplete(countDownLatch::countDown) //
|
.doOnSuccess(it -> countDownLatch.countDown()) //
|
||||||
.doOnError(throwable -> countDownLatch.countDown()) //
|
.doOnError(throwable -> countDownLatch.countDown()) //
|
||||||
.subscribe();
|
.subscribe();
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 the original author or authors.
|
* Copyright 2016-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -18,9 +18,9 @@ package example.springdata.cassandra.people;
|
|||||||
import static org.assertj.core.api.Assertions.*;
|
import static org.assertj.core.api.Assertions.*;
|
||||||
|
|
||||||
import example.springdata.cassandra.util.CassandraKeyspace;
|
import example.springdata.cassandra.util.CassandraKeyspace;
|
||||||
import rx.Completable;
|
import io.reactivex.Completable;
|
||||||
import rx.Observable;
|
import io.reactivex.Flowable;
|
||||||
import rx.Single;
|
import io.reactivex.Single;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
@@ -35,7 +35,7 @@ import org.springframework.data.cassandra.core.ReactiveCassandraOperations;
|
|||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Integration test for {@link RxJava1PersonRepository} using RxJava1 types. Note that
|
* Integration test for {@link RxJava2PersonRepository} using RxJava1 types. Note that
|
||||||
* {@link ReactiveCassandraOperations} is only available using Project Reactor types as the native Template API
|
* {@link ReactiveCassandraOperations} is only available using Project Reactor types as the native Template API
|
||||||
* implementation does not come in multiple reactive flavors.
|
* implementation does not come in multiple reactive flavors.
|
||||||
*
|
*
|
||||||
@@ -43,11 +43,11 @@ import org.springframework.test.context.junit4.SpringRunner;
|
|||||||
*/
|
*/
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
public class RxJava1PersonRepositoryIntegrationTest {
|
public class RxJava2PersonRepositoryIntegrationTest {
|
||||||
|
|
||||||
@ClassRule public final static CassandraKeyspace CASSANDRA_KEYSPACE = CassandraKeyspace.onLocalhost();
|
@ClassRule public final static CassandraKeyspace CASSANDRA_KEYSPACE = CassandraKeyspace.onLocalhost();
|
||||||
|
|
||||||
@Autowired RxJava1PersonRepository repository;
|
@Autowired RxJava2PersonRepository repository;
|
||||||
@Autowired ReactiveCassandraOperations operations;
|
@Autowired ReactiveCassandraOperations operations;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@@ -55,12 +55,12 @@ public class RxJava1PersonRepositoryIntegrationTest {
|
|||||||
|
|
||||||
Completable deleteAll = repository.deleteAll();
|
Completable deleteAll = repository.deleteAll();
|
||||||
|
|
||||||
Observable<Person> save = repository.save(Observable.just(new Person("Walter", "White", 50), //
|
Flowable<Person> save = repository.saveAll(Flowable.just(new Person("Walter", "White", 50), //
|
||||||
new Person("Skyler", "White", 45), //
|
new Person("Skyler", "White", 45), //
|
||||||
new Person("Saul", "Goodman", 42), //
|
new Person("Saul", "Goodman", 42), //
|
||||||
new Person("Jesse", "Pinkman", 27)));
|
new Person("Jesse", "Pinkman", 27)));
|
||||||
|
|
||||||
deleteAll.andThen(save).toBlocking().last();
|
deleteAll.andThen(save).blockingLast();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -73,10 +73,10 @@ public class RxJava1PersonRepositoryIntegrationTest {
|
|||||||
|
|
||||||
repository.count() //
|
repository.count() //
|
||||||
.doOnSuccess(System.out::println) //
|
.doOnSuccess(System.out::println) //
|
||||||
.toObservable() //
|
.toFlowable() //
|
||||||
.switchMap(count -> repository.save(Observable.just(new Person("Hank", "Schrader", 43), //
|
.switchMap(count -> repository.saveAll(Flowable.just(new Person("Hank", "Schrader", 43), //
|
||||||
new Person("Mike", "Ehrmantraut", 62)))) //
|
new Person("Mike", "Ehrmantraut", 62)))) //
|
||||||
.last() //
|
.lastElement() //
|
||||||
.toSingle() //
|
.toSingle() //
|
||||||
.flatMap(v -> repository.count()) //
|
.flatMap(v -> repository.count()) //
|
||||||
.doOnSuccess(System.out::println) //
|
.doOnSuccess(System.out::println) //
|
||||||
@@ -98,7 +98,7 @@ public class RxJava1PersonRepositoryIntegrationTest {
|
|||||||
|
|
||||||
repository.findAll() //
|
repository.findAll() //
|
||||||
.doOnNext(System.out::println) //
|
.doOnNext(System.out::println) //
|
||||||
.doOnCompleted(countDownLatch::countDown) //
|
.doOnEach(it -> countDownLatch.countDown()) //
|
||||||
.doOnError(throwable -> countDownLatch.countDown()) //
|
.doOnError(throwable -> countDownLatch.countDown()) //
|
||||||
.subscribe();
|
.subscribe();
|
||||||
|
|
||||||
@@ -113,8 +113,7 @@ public class RxJava1PersonRepositoryIntegrationTest {
|
|||||||
|
|
||||||
List<Person> whites = repository.findByLastname("White") //
|
List<Person> whites = repository.findByLastname("White") //
|
||||||
.toList() //
|
.toList() //
|
||||||
.toBlocking() //
|
.blockingGet();
|
||||||
.last();
|
|
||||||
|
|
||||||
assertThat(whites).hasSize(2);
|
assertThat(whites).hasSize(2);
|
||||||
}
|
}
|
||||||
@@ -126,8 +125,7 @@ public class RxJava1PersonRepositoryIntegrationTest {
|
|||||||
public void shouldQueryDataWithStringQuery() {
|
public void shouldQueryDataWithStringQuery() {
|
||||||
|
|
||||||
Person heisenberg = repository.findByFirstnameAndLastname("Walter", "White") //
|
Person heisenberg = repository.findByFirstnameAndLastname("Walter", "White") //
|
||||||
.toBlocking() //
|
.blockingGet();
|
||||||
.value();
|
|
||||||
|
|
||||||
assertThat(heisenberg).isNotNull();
|
assertThat(heisenberg).isNotNull();
|
||||||
}
|
}
|
||||||
@@ -140,8 +138,7 @@ public class RxJava1PersonRepositoryIntegrationTest {
|
|||||||
|
|
||||||
List<Person> whites = repository.findByLastname(Single.just("White")) //
|
List<Person> whites = repository.findByLastname(Single.just("White")) //
|
||||||
.toList() //
|
.toList() //
|
||||||
.toBlocking() //
|
.blockingGet();
|
||||||
.single();
|
|
||||||
|
|
||||||
assertThat(whites).hasSize(2);
|
assertThat(whites).hasSize(2);
|
||||||
}
|
}
|
||||||
@@ -153,7 +150,7 @@ public class RxJava1PersonRepositoryIntegrationTest {
|
|||||||
public void shouldQueryDataWithMixedDeferredQueryDerivation() {
|
public void shouldQueryDataWithMixedDeferredQueryDerivation() {
|
||||||
|
|
||||||
Person heisenberg = repository.findByFirstnameAndLastname(Single.just("Walter"), "White") //
|
Person heisenberg = repository.findByFirstnameAndLastname(Single.just("Walter"), "White") //
|
||||||
.toBlocking().value();
|
.blockingGet();
|
||||||
|
|
||||||
assertThat(heisenberg).isNotNull();
|
assertThat(heisenberg).isNotNull();
|
||||||
}
|
}
|
||||||
2
pom.xml
2
pom.xml
@@ -12,7 +12,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>1.5.4.RELEASE</version>
|
<version>1.5.6.RELEASE</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
|||||||
@@ -13,10 +13,10 @@
|
|||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<spring-data-releasetrain.version>Kay-M1</spring-data-releasetrain.version>
|
<spring-data-releasetrain.version>Kay-RC2</spring-data-releasetrain.version>
|
||||||
<spring.version>5.0.0.M3</spring.version>
|
<spring.version>5.0.0.RC3</spring.version>
|
||||||
<reactor.version>3.0.3.RELEASE</reactor.version>
|
<reactor.version>3.1.0.M3</reactor.version>
|
||||||
<lettuce.version>5.0.0.Beta1</lettuce.version>
|
<lettuce.version>5.0.0.RC1</lettuce.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -32,8 +32,8 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>biz.paluch.redis</groupId>
|
<groupId>io.lettuce</groupId>
|
||||||
<artifactId>lettuce</artifactId>
|
<artifactId>lettuce-core</artifactId>
|
||||||
<version>${lettuce.version}</version>
|
<version>${lettuce.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 the original author or authors.
|
* Copyright 2016-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -15,6 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package example.springdata.redis.commands;
|
package example.springdata.redis.commands;
|
||||||
|
|
||||||
|
import example.springdata.redis.RedisTestConfiguration;
|
||||||
|
import example.springdata.redis.test.util.RequiresRedisServer;
|
||||||
|
import reactor.core.publisher.Flux;
|
||||||
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -28,17 +33,13 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.data.redis.connection.ReactiveListCommands.PopResult;
|
import org.springframework.data.redis.connection.ReactiveListCommands.PopResult;
|
||||||
import org.springframework.data.redis.connection.ReactiveRedisConnection;
|
import org.springframework.data.redis.connection.ReactiveRedisConnection;
|
||||||
|
import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory;
|
||||||
import org.springframework.data.redis.connection.ReactiveStringCommands.SetCommand;
|
import org.springframework.data.redis.connection.ReactiveStringCommands.SetCommand;
|
||||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
import example.springdata.redis.RedisTestConfiguration;
|
|
||||||
import example.springdata.redis.test.util.RequiresRedisServer;
|
|
||||||
import reactor.core.publisher.Flux;
|
|
||||||
import reactor.core.publisher.Mono;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show usage of reactive operations on Redis keys using low level API provided by {@link RedisConnectionFactory}.
|
* Show usage of reactive operations on Redis keys using low level API provided by {@link RedisConnectionFactory}.
|
||||||
*
|
*
|
||||||
@@ -54,7 +55,7 @@ public class KeyOperationsTests {
|
|||||||
private static final String PREFIX = KeyOperationsTests.class.getSimpleName();
|
private static final String PREFIX = KeyOperationsTests.class.getSimpleName();
|
||||||
private static final String KEY_PATTERN = PREFIX + "*";
|
private static final String KEY_PATTERN = PREFIX + "*";
|
||||||
|
|
||||||
@Autowired RedisConnectionFactory connectionFactory;
|
@Autowired ReactiveRedisConnectionFactory connectionFactory;
|
||||||
|
|
||||||
private ReactiveRedisConnection connection;
|
private ReactiveRedisConnection connection;
|
||||||
private RedisSerializer<String> serializer = new StringRedisSerializer();
|
private RedisSerializer<String> serializer = new StringRedisSerializer();
|
||||||
@@ -76,7 +77,7 @@ public class KeyOperationsTests {
|
|||||||
|
|
||||||
this.connection.keyCommands() //
|
this.connection.keyCommands() //
|
||||||
.keys(ByteBuffer.wrap(serializer.serialize(KEY_PATTERN))) //
|
.keys(ByteBuffer.wrap(serializer.serialize(KEY_PATTERN))) //
|
||||||
.flatMap(Flux::fromIterable) //
|
.flatMapMany(Flux::fromIterable) //
|
||||||
.doOnNext(byteBuffer -> System.out.println(toString(byteBuffer))) //
|
.doOnNext(byteBuffer -> System.out.println(toString(byteBuffer))) //
|
||||||
.count() //
|
.count() //
|
||||||
.doOnSuccess(count -> System.out.println(String.format("Total No. found: %s", count))) //
|
.doOnSuccess(count -> System.out.println(String.format("Total No. found: %s", count))) //
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.xmlbeam</groupId>
|
<groupId>org.xmlbeam</groupId>
|
||||||
<artifactId>xmlprojector</artifactId>
|
<artifactId>xmlprojector</artifactId>
|
||||||
<version>1.4.8</version>
|
<version>1.4.13</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
@@ -1,2 +1 @@
|
|||||||
logging.level.org.springframework.web=DEBUG
|
logging.level.org.springframework.web=DEBUG
|
||||||
logging.level.org.springframework.boot=DEBUG
|
|
||||||
|
|||||||
Reference in New Issue
Block a user