Top Banner
Subject in RxJava 장장장 [email protected]
12

Subject in RxJava

Jan 06, 2017

Download

Software

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Subject in RxJava

Subject in RxJava장인수

[email protected]

Page 2: Subject in RxJava

Subject

1. AsyncSubject

2. BehaviorSubject

3. PublishSubject

4. ReplaySubject

Page 3: Subject in RxJava

What’s the Subject?A Subject is a sort of bridge or proxy that acts both as a

Subscriber and as an Observable. Because it is a Subscriber, it can subscribe to one or more Observables, and because it is an Observable, it can pass through the

items it observes by reemitting them, and it can also emit new items.

Subject = Observable + Subscriber Observable 과 Subscriber 연결하는 다리같은 역할

Page 4: Subject in RxJava

1. AsyncSubjectAsyncSubject 는 Observable 이 완료되었을 때 구독하고 있는

각 Observer 에게 관찰한 마지막 아이템만을 발행한다 .

Page 5: Subject in RxJava

not CompletedAsyncSubject 는 Observable 이 완료되었을 때 구독하고 있는

각 Observer 에게 관찰한 마지막 아이템만을 발행한다 .

Page 6: Subject in RxJava

2. BehaviorSubject기본적으로 BehaviorSubject 는 가장 최근에 관찰된 아이템과

그 후에 관찰된 나머지 아이템을 구독하는 Observer 에게 발행하는 Subject이다 .

Page 7: Subject in RxJava
Page 8: Subject in RxJava

3. PublishSubject기본적인 subject 객체다 .

구독한 시점부터 이후에 발생되어지는 이벤트들을 전달받습니다 .

Page 9: Subject in RxJava

4. ReplaySubject관찰한 모든 아이템을 버퍼에 저장하고 구독하는 Observer 에게 재생한다 .

Page 10: Subject in RxJava

Q & A

Page 11: Subject in RxJava

감사합니다 .

Page 12: Subject in RxJava

참고자료

• http://goo.gl/ztz2as

• http://reactivex.io/documentation/subject.html

• http://www.introtorx.com/Content/v1.0.10621.0/02_KeyTypes.html#AsyncSubject

• http://www.introtorx.com/Content/v1.0.10621.0/02_KeyTypes.html#BehaviorSubject

• http://reactivex.io/RxJava/javadoc/rx/subjects/BehaviorSubject.html

• http://www.introtorx.com/Content/v1.0.10621.0/02_KeyTypes.html#ReplaySubject

• https://tech.instacart.com/how-to-think-about-subjects-part-1/