T - type of payloadpublic interface Emitter<T> extends EmitterBehavior
Instances are injected using:
@Inject
@Channel("my-channel")
Emitter<String> emitter;
You can use an injected emitter to send either payloads or
Messages.
The name of the channel (given in the Channel annotation)
indicates which channel is fed. It must match the name used in a method using
@Incoming or an
outgoing channel configured in the application configuration.
The OnOverflow annotation can be used to configure what to do if
messages are sent using the `Emitter` when a downstream subscriber hasn't requested
more messages.
| Modifier and Type | Method and Description |
|---|---|
<M extends Message<? extends T>> |
send(M msg)
Sends a message to the channel.
|
CompletionStage<Void> |
send(T msg)
Sends a payload to the channel.
|
complete, error, hasRequests, isCancelledCompletionStage<Void> send(T msg)
A Message object will be created to hold the payload and the returned CompletionStage will be completed
once this
Message is acknowledged. If the Message is never acknowledged, then the CompletionStage will
never be completed.
msg - the thing to send, must not be nullCompletionStage, which will be completed when the message for this payload is acknowledged.IllegalStateException - if the channel has been cancelled or terminated or if an overflow strategy of
THROW_EXCEPTION or BUFFER is
configured and the emitter overflows.<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 cancelled or terminated or if an overflow strategy of
THROW_EXCEPTION or BUFFER is
configured and the emitter overflows.Copyright © 2018–2020 SmallRye. All rights reserved.