Commit 5151c0ee authored by vikram singh's avatar vikram singh

separeted folders of java 9 flow API

parent 6456ad4c
package com.nisum.java9Features.reactiveapi.asynchronous; package com.nisum.java9Features.reactiveapi.rxjava.asynchronous;
import io.reactivex.BackpressureStrategy; import io.reactivex.BackpressureStrategy;
import io.reactivex.Flowable; import io.reactivex.Flowable;
......
package com.nisum.java9Features.reactiveapi.drop; package com.nisum.java9Features.reactiveapi.rxjava.drop;
import io.reactivex.BackpressureStrategy; import io.reactivex.BackpressureStrategy;
import io.reactivex.Flowable; import io.reactivex.Flowable;
......
package com.nisum.java9Features.reactiveapi.error; package com.nisum.java9Features.reactiveapi.rxjava.error;
import io.reactivex.BackpressureStrategy; import io.reactivex.BackpressureStrategy;
import io.reactivex.Flowable; import io.reactivex.Flowable;
......
package com.nisum.java9Features.reactiveapi.latest; package com.nisum.java9Features.reactiveapi.rxjava.latest;
import io.reactivex.BackpressureStrategy; import io.reactivex.BackpressureStrategy;
import io.reactivex.Flowable; import io.reactivex.Flowable;
...@@ -7,7 +7,7 @@ import io.reactivex.schedulers.Schedulers; ...@@ -7,7 +7,7 @@ import io.reactivex.schedulers.Schedulers;
/** /**
* *
* BackpressureStrategy.LATES * BackpressureStrategy.LATEST
* It is one of the backpressure strategy to handle the flow of the data; * It is one of the backpressure strategy to handle the flow of the data;
* It gives the latest data to the subscriber rather if any subscriber subscribes; * It gives the latest data to the subscriber rather if any subscriber subscribes;
*/ */
......
package com.nisum.java9Features.reactiveapi.rxjavaflowable; package com.nisum.java9Features.reactiveapi.rxjava.rxjavaflowable;
import io.reactivex.BackpressureStrategy; import io.reactivex.BackpressureStrategy;
import io.reactivex.Flowable; import io.reactivex.Flowable;
......
package com.nisum.java9Features.reactiveapi.slowsubscriber; package com.nisum.java9Features.reactiveapi.rxjava.slowsubscriber;
import io.reactivex.BackpressureStrategy; import io.reactivex.BackpressureStrategy;
import io.reactivex.Flowable; import io.reactivex.Flowable;
......
package com.nisum.java9Features.reactiveapi.synchronous; package com.nisum.java9Features.reactiveapi.rxjava.synchronous;
import io.reactivex.BackpressureStrategy; import io.reactivex.BackpressureStrategy;
import io.reactivex.Flowable; import io.reactivex.Flowable;
......
package com.nisum.java9Features.reactiveapi.submissionpublisher; package com.nisum.java9Features.reactiveapi.submissionpublisher;
import java.util.concurrent.Flow; import java.util.concurrent.Flow.Subscriber;
import java.util.concurrent.Flow.Subscription;
/** /**
* creating the subscriber implementing the Flow.Subscriber given by jdk 9 * creating the subscriber implementing the Flow.Subscriber given by jdk 9
* here we are maintaining the flow of data as well using request method of Subscription Interface;; * here we are maintaining the flow of data as well using request method of Subscription Interface;;
*/ */
public class PrintResultSubscriber implements Flow.Subscriber<String> { public class PrintResultSubscriber implements Subscriber<String> {
private Flow.Subscription subscription; private Subscription subscription;
//initially user is asking for the no of initial data
@Override @Override
public void onSubscribe(Flow.Subscription subscription) { public void onSubscribe(Subscription subscription) {
System.out.println("subscribed..."); System.out.println("subscribed...");
this.subscription = subscription; this.subscription = subscription;
subscription.request(5); subscription.request(5);
......
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