T - type of payload or
Message.public interface Emitter<T>
Instances are injected using:
@Inject
@Channel("my-channel")
Emitter<String> emitter;
You can inject emitter sending payload or
Messages.
The name of the channel (given in the Channel annotation)
indicates which streams is fed. It must match the name used in a method using
@Incoming or an
outgoing stream configured in the application configuration.
| Modifier and Type | Method and Description |
|---|---|
void |
complete()
Sends the completion event to the channel indicating that no other events will be sent afterward.
|
void |
error(Exception e)
Sends a failure event to the channel.
|
boolean |
isCancelled() |
boolean |
isRequested() |
<M extends Message<? extends T>> |
send(M msg)
Sends a payload to the channel.
|
CompletionStage<Void> |
send(T msg)
Sends a payload to the channel.
|
CompletionStage<Void> send(T msg)
msg - the thing to send, must not be nullCompletionStage, which will be completed as sending the payload alone does not provide a callback
mechanism.IllegalStateException - if the channel has been canceled or terminated.<M extends Message<? extends T>> void send(M msg)
M - the Message typemsg - the Message to send, must not be nullIllegalStateException - if the channel has been canceled or terminated.void complete()
void error(Exception e)
e - the exception, must not be nullboolean isCancelled()
true if the emitter has been terminated or the subscription cancelled.boolean isRequested()
true if the subscriber accepts messages, false otherwise.
Using send(Object) on an emitter not expecting message would throw an IllegalStateException.Copyright © 2018–2020 SmallRye. All rights reserved.