Class AbstractEmitter<T>
- java.lang.Object
-
- io.smallrye.reactive.messaging.extension.AbstractEmitter<T>
-
- All Implemented Interfaces:
EmitterBehavior
- Direct Known Subclasses:
EmitterImpl
,MutinyEmitterImpl
public abstract class AbstractEmitter<T> extends Object implements EmitterBehavior
-
-
Field Summary
Fields Modifier and Type Field Description protected AtomicReference<io.smallrye.mutiny.subscription.MultiEmitter<? super Message<? extends T>>>
internal
protected String
name
protected io.smallrye.mutiny.Multi<Message<? extends T>>
publisher
protected AtomicReference<Throwable>
synchronousFailure
-
Constructor Summary
Constructors Constructor Description AbstractEmitter(EmitterConfiguration config, long defaultBufferSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
complete()
Sends the completion event to the channel indicating that no other events will be sent afterward.protected void
emit(Message<? extends T> message)
void
error(Exception e)
Sends a failure event to the channel.org.reactivestreams.Publisher<Message<? extends T>>
getPublisher()
boolean
hasRequests()
boolean
isCancelled()
-
-
-
Field Detail
-
internal
protected final AtomicReference<io.smallrye.mutiny.subscription.MultiEmitter<? super Message<? extends T>>> internal
-
name
protected final String name
-
synchronousFailure
protected final AtomicReference<Throwable> synchronousFailure
-
-
Constructor Detail
-
AbstractEmitter
public AbstractEmitter(EmitterConfiguration config, long defaultBufferSize)
-
-
Method Detail
-
complete
public void complete()
Description copied from interface:EmitterBehavior
Sends the completion event to the channel indicating that no other events will be sent afterward.- Specified by:
complete
in interfaceEmitterBehavior
-
error
public void error(Exception e)
Description copied from interface:EmitterBehavior
Sends a failure event to the channel. No more events will be sent afterward.- Specified by:
error
in interfaceEmitterBehavior
- Parameters:
e
- the exception, must not benull
-
isCancelled
public boolean isCancelled()
- Specified by:
isCancelled
in interfaceEmitterBehavior
- Returns:
true
if the emitter has been terminated or the subscription cancelled.
-
hasRequests
public boolean hasRequests()
- Specified by:
hasRequests
in interfaceEmitterBehavior
- Returns:
true
if one or more subscribers request messages from the corresponding channel where the emitter connects to, returnfalse
otherwise.
-
-