Stay organized with collections
Save and categorize content based on your preferences.
Subscription
interface Subscription
Message control linking a Publisher
and Subscriber
. Subscribers receive items only when requested, and may cancel at any time. The methods in this interface are intended to be invoked only by their Subscribers; usages in other contexts have undefined effects.
Summary
Public methods |
abstract Unit |
Causes the Subscriber to (eventually) stop receiving messages.
|
abstract Unit |
Adds the given number n of items to the current unfulfilled demand for this subscription.
|
Public methods
cancel
abstract fun cancel(): Unit
Causes the Subscriber to (eventually) stop receiving messages. Implementation is best-effort -- additional messages may be received after invoking this method. A cancelled subscription need not ever receive an onComplete
or onError
signal.
request
abstract fun request(n: Long): Unit
Adds the given number n
of items to the current unfulfilled demand for this subscription. If n
is less than or equal to zero, the Subscriber will receive an onError
signal with an IllegalArgumentException
argument. Otherwise, the Subscriber will receive up to n
additional onNext
invocations (or fewer if terminated).
Parameters |
n |
Long: the increment of demand; a value of Long.MAX_VALUE may be considered as effectively unbounded |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2020-08-04 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2020-08-04 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2020-08-04 UTC."]]