Files
spring-data-examples/couchbase/reactive
Spring Operator ccae97890f #491 - URL Cleanup.
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* [ ] http://www.apache.org/licenses/ with 1 occurrences migrated to:
  https://www.apache.org/licenses/ ([https](https://www.apache.org/licenses/) result 200).
* [ ] http://www.apache.org/licenses/LICENSE-2.0 with 426 occurrences migrated to:
  https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200).
2019-03-22 08:13:14 +01:00
..
2019-03-22 08:13:14 +01:00
2019-03-20 10:10:59 -05:00
2017-11-24 09:39:18 +01:00

Spring Data Couchbase 3.0 - Reactive examples

This project contains samples of reactive data access features with Spring Data (Couchbase).

Reactive Template API usage with RxJavaCouchbaseOperations

The main reactive Template API class is RxJavaCouchbaseTemplate, ideally used through its interface RxJavaCouchbaseOperations. It defines a basic set of reactive data access operations using RxJava 1 Single and Observable reactive types.

Airline airline = new Airline();

Observable<Airline> single = operations.save(airline)

Observable<Airline> airlines = operations.findByView(ViewQuery.from("airlines", "all"), Airline.class);

The test cases in RxJavaCouchbaseOperationsIntegrationTests show basic Template API usage. Reactive data access reads and converts individual elements while processing the stream.

Reactive Repository support

Spring Data Couchbase provides reactive repository support with Project Reactor, RxJava 1 and RxJava 2 reactive types. The reactive API supports reactive type conversion between reactive types.

@N1qlPrimaryIndexed
@ViewIndexed(designDoc = "airlines")
public interface ReactiveAirlineRepository extends ReactiveCrudRepository<Airline, String> {

    Mono<Airline> findAirlineByIataCode(String code);

    @View(designDocument = "airlines", viewName = "all")
    Flux<Airline> findAllBy();
}
@N1qlPrimaryIndexed
@ViewIndexed(designDoc = "airlines")
public interface RxJava1AirlineRepository extends Repository<Airline, String> {

    Single<Airline> findAirlineByIataCode(String code);

    @View(designDocument = "airlines", viewName = "all")
    Observable<Airline> findAllBy();

    Single<Airline> findById(String id);

    Single<Airline> save(Airline airline);
}