- Type Parameters:
T- type of payload
- All Known Implementing Classes:
@Experimental("smallrye-only, added to the specification") public interface Emitter<T>Interface used to feed a channel from an imperative piece of code.
Instances are injected using:
@Inject @Channel("my-channel") Emitter<String> emitter;
You can use an injected emitter to send either payloads or
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
@Incomingor an outgoing channel configured in the application configuration.
OnOverflow annotationcan be used to configure what to do if messages are sent using the `Emitter` when a downstream subscriber hasn't requested more messages.
All Methods Instance Methods Abstract Methods Modifier and Type Method Description
complete()Sends the completion event to the channel indicating that no other events will be sent afterward.
error(Exception e)Sends a failure event to the channel.
<M extends Message<? extends T>>
send(M msg)Sends a message to the channel.
send(T msg)Sends a payload to the channel.
CompletionStage<Void> send(T msg)Sends a payload to the channel.
Messageobject will be created to hold the payload and the returned
CompletionStagewill be completed once this
Messageis acknowledged. If the
Messageis never acknowledged, then the
CompletionStagewill never be completed.
msg- the thing to send, must not be
CompletionStage, 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
BUFFERis configured and the emitter overflows.
sendSends a message to the channel.
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. No more events will be sent afterward.
e- the exception, must not be
trueif the emitter has been terminated or the subscription cancelled.
trueif one or more subscribers request messages from the corresponding channel where the emitter connects to, return