Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jnosql-dev] [nosql-dev] Create a Reactive Stream as an extension

Otavio/all,

 

Please note, that Neither MicroProfile Reactive Streams, Messaging or whatever MUST NOT be used by Jakarta NoSQL or any other Jakarta EE spec at this Point!!!

 

Until every MP Project is governed by a new WG that does not exist yet and gets the IP flow in order, it cannot be used by Jakarta EE, just the same way you already mentioned with Config.

 

Only Eclipse JNoSQL on an implementation Level may already use MicroProfile.

So please take that into consideration and either we postpone the whole aysnc and reactive Topics till there is a workable solution or we have to do something in Jakarta EE instead.

 

Regards,

Werner

 

Sent from Mail for Windows 10

 

From: Otavio Santana
Sent: Thursday, April 30, 2020 15:25
To: jnosql developer discussions; nosql developer discussions
Subject: [nosql-dev] Create a Reactive Stream as an extension

 

Goal

The goal of this proposal is to write an extension to each API that allows integration with Reactive Streams API.
Briefly, Reactive Stream is an initiative to provide a standard for asynchronous stream processing with non-blocking backpressure.

This extension will work integrated with the Eclipse MicroProfile Reactive Streams Operators.

About Reactive Streams

Reactive Streams is an integration SPI - it allows two different libraries that provide asynchronous streaming to be able to stream data to and from each other.

Reactive Streams is not however designed to be used directly by application developers. The semantics defined by Reactive Streams are very strict, and are nontrivial, particularly in the areas of thread safety, to implement correctly. Typically, application developers are expected to use third-party libraries that provide the tools necessary to manipulate and control streams. Examples include Akka Streams, RxJava, and Reactor.

Repository

The repositories programming model is the most high-level abstraction and we’ll have a repository to handle with ReactiveRepository:

 
public interface GodRepository extends ReactiveRepository<God, String> {
}
 
String id =...;
Publisher<God> publisher = repository.findById("id");
CompletionSubscriber<God, Optional<God>> subscriber = ReactiveStreams.<God>builder().findFirst().build();
publisher.subscribe(subscriber);
CompletionStage<Optional<God>> completion = subscriber.getCompletion();

Templates

Just as the traditional repositories are based on traditional template implementations, the reactive ones are built on top of a reactive template.

·        ReactiveKeyValueTemplate

·        ReactiveDocumentTemplate

·        ReactiveColumnTemplate

ReactiveKeyValueTemplate template
Publisher<God> publisher = template.get("id", God.class);
CompletionSubscriber<God, Optional<God>> subscriber = ReactiveStreams.<God>builder().findFirst().build();
publisher.subscribe(subscriber);
CompletionStage<Optional<God>> completion = subscriber.getCompletion();

References:

·        https://spring.io/blog/2016/11/28/going-reactive-with-spring-data

·        MicroProfile Reactive Streams Operators Specification

 

--

Otávio Santana

 

 


Back to the top