package rxjava;

import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;

import io.reactivex.BackpressureStrategy;
import io.reactivex.Flowable;
import io.reactivex.FlowableEmitter;
import io.reactivex.FlowableOnSubscribe;
/**
 * 
 * 
 * @author thinkpad
 *
 */
public class HelloWorld2 {
	public static void main(String[] args) {
		
		/**
		 * Flowable  实现 Publisher接口
		 * 
		 */
		Flowable<String> flowable = Flowable.create(new FlowableOnSubscribe<String>() {

			@Override
			public void subscribe(FlowableEmitter<String> e) throws Exception {
				e.onNext("xxx");
				e.onNext("hello RxJava 2");
				e.onComplete();
			}
		}, BackpressureStrategy.BUFFER);
		Subscriber<String> subscriber = new Subscriber<String>() {
			@Override
			public void onSubscribe(Subscription s) {
				System.out.println("onSubscribe");
				s.request(Long.MAX_VALUE);
			}

			@Override
			public void onNext(String s) {

				System.out.println(s);
			}

			@Override
			public void onError(Throwable t) {

			}

			@Override
			public void onComplete() {
				System.out.println("onCompxxx");
			}

		};

		Subscriber<String> subscriber2 = new Subscriber<String>() {

			@Override
			public void onSubscribe(Subscription arg0) {
				System.out.println("第二个订阅类");
				arg0.request(Long.MAX_VALUE);

			}

			@Override
			public void onNext(String arg0) {
				System.out.println("第二个订阅类" + arg0);
			}

			@Override
			public void onError(Throwable arg0) {
				// TODO Auto-generated method stub

			}

			@Override
			public void onComplete() {
				// TODO Auto-generated method stub

			}
		};

		flowable.subscribe(subscriber);
		flowable.subscribe(subscriber2);
	}
}

@@ -268,16 +268,11 @@
 hor 
-thinkpad
+%E5%BC%A0%E5%A4%A7%E5%B7%9D
 %0A *%0A
@@ -386,18 +386,41 @@
 er%E6%8E%A5%E5%8F%A3%0A%09%09 
-*
  
+ %0A%09%09 * Publisher %E4%B8%BA%E5%8F%91%E5%B8%83%E8%80%85%E7%9A%84%E5%90%AB%E4%B9%89
 %0A%09%09 */%0A%09

Update HelloWorld2.java