RxJava: Difference between revisions

From BITPlan Wiki
Jump to navigation Jump to search
Line 32: Line 32:
         void onNext(T t)
         void onNext(T t)
         void onSubscribe(Subscription s)
         void onSubscribe(Subscription s)
    }
note top of Subscription
A Subscription represents a
one-to-one lifecycle of a Subscriber
subscribing to a Publisher.
It can only be used once by a single Subscriber.
It is used to both signal desire for data
and cancel demand (and allow resource cleanup).
see [[https://www.reactive-streams.org/reactive-streams-1.0.0-javadoc/org/reactivestreams/Subscription.html javadoc]]
end note
    interface Subscription {
        void cancel()
        void request(long n)
     }
     }
   }
   }

Revision as of 12:59, 2 March 2020