T - type of payloadpublic interface MutinyEmitter<T> extends EmitterBehavior
Instances are injected using:
@Inject
@Channel("my-channel")
MutinyEmitter<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 `MutinyEmitter` 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.
|
io.smallrye.mutiny.Uni<Void> |
send(T payload)
Sends a payload to the channel.
|
void |
sendAndAwait(T payload)
Sends a payload to the channel.
|
io.smallrye.mutiny.subscription.Cancellable |
sendAndForget(T payload)
Sends a payload to the channel without waiting for acknowledgement.
|
complete, error, hasRequests, isCancelledio.smallrye.mutiny.Uni<Void> send(T payload)
A Message object will be created to hold the payload and the returned Uni
can be subscribed to for triggering the send.
When subscribed, a null item will be passed to the Uni when the
Message is acknowledged. If the Message is never acknowledged, then the Uni will
never be completed.
The Message will not be sent to the channel until the Uni has been subscribed to:
emitter.send("a").subscribe().with(x -> {
});
payload - the thing to send, must not be nullUni, that requires subscription to send the Message.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.void sendAndAwait(T payload)
A Message object will be created to hold the payload.
Execution will block waiting for the resulting Message to be acknowledged before returning.
payload - the thing 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.io.smallrye.mutiny.subscription.Cancellable sendAndForget(T payload)
A Message object will be created to hold the payload.
payload - the thing to send, must not be nullCancellable from the subscribed Uni.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.