Class StreamerPublisher<T>
java.lang.Object
org.apache.ignite.migrationtools.persistence.utils.pubsub.StreamerPublisher<T>
- All Implemented Interfaces:
AutoCloseable,Flow.Publisher<T>,Flow.Subscription
public class StreamerPublisher<T>
extends Object
implements Flow.Publisher<T>, Flow.Subscription, AutoCloseable
Publisher for streamer. A lighter alternative to
SubmissionPublisher.
Single-threaded.
Only supports one subscriber.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()voidclose()voidcloseExceptionally(Throwable error) Close with error.booleanOffer a new item to the subscriber.voidrequest(long n) voidsubscribe(Flow.Subscriber<? super T> subscriber)
-
Constructor Details
-
StreamerPublisher
public StreamerPublisher()
-
-
Method Details
-
subscribe
- Specified by:
subscribein interfaceFlow.Publisher<T>
-
request
public void request(long n) - Specified by:
requestin interfaceFlow.Subscription
-
cancel
public void cancel()- Specified by:
cancelin interfaceFlow.Subscription
-
offer
Offer a new item to the subscriber.- Parameters:
item- Item to be offered.- Returns:
- Whether the element was successfully published or not.
- Throws:
InterruptedException- if the thread was interrupted.
-
closeExceptionally
Close with error. -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-