Commit 6456ad4c authored by vikram singh's avatar vikram singh

updated the README.md

parent 8c10364c
#Java 9 Feature # Java 9 Feature
ReactiveStreams **Java 9 Flow API Classes and Interfaces**
DiamondOperator
FactoryMethodsForUnmodifiableCollections Let’s have a quick look at Flow API classes and interfaces.
PrivateMethods
ProcessAPI **java.util.concurrent.Flow:**
StreamApI
TryWithResourcesEnhancements
Java 9 is providing standard of the Reactive programming This is the main class of Flow API. This class encapsulates all the important interfaces of the Flow API. This is a final class and we can’t extend it.
___Publisher **java.util.concurrent.Flow.Publisher:**
Subscriber
Processor This is a functional interface and every publisher has to implement it’s subscribe method to add the given subscriber to receive messages.
Subscription___
**java.util.concurrent.Flow.Subscriber:**
asynchronous Every subscriber has to implement this interface. The methods in the subscriber are invoked in strict sequential order. There are four methods in this interface:
coldpublisher
drop **onSubscribe:**
error
hotpublisher This is the first method to get invoked when subscriber is subscribed to receive messages by publisher. Usually we invoke subscription.request to start receiving items from processor.
rxjavaflowable
slowsubscriber **onNext:**
submissionpublisher
synchronous This method gets invoked when an item is received from publisher, this is where we implement our business logic to process the stream and then request for more data from publisher.
**onError:**
This method is invoked when an irrecoverable error occurs, we can do cleanup taks in this method, such as closing database connection.
**onComplete:**
This is like finally method and gets invoked when no other items are being produced by publisher and publisher is closed. We can use it to send notification of successful processing of stream.
**java.util.concurrent.Flow.Subscription:**
This is used to create asynchronous non-blocking link between publisher and subscriber. Subscriber invokes its request method to demand items from publisher. It also has cancel method to cancel the subscription i.e. closing the link between publisher and subscriber.
**java.util.concurrent.Flow.Processor:**
This interface extends both Publisher and Subscriber, this is used to transform the message between publisher and subscriber.
**java.util.concurrent.SubmissionPublisher:**
A Publisher implementation that asynchronously issues submitted items to current subscribers until it is closed. It uses Executor framework We will use this class in reactive stream examples to add subscriber and then submit items to them.
**Reference**
[https://www.journaldev.com/20723/java-9-reactive-streams]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment