@Experimental(value="SmallRye only feature")
public interface MessageConverter
extends javax.enterprise.inject.spi.Prioritized
Message<A> into Message<B>.
To register a converter, expose a, generally ApplicationScoped bean, implementing this interface.
When multiple converters are available, implementation should override the getPriority() method.
The default priority is CONVERTER_DEFAULT_PRIORITY. Converters with higher priority are executed first.
| Modifier and Type | Interface and Description |
|---|---|
static class |
MessageConverter.IdentityConverter |
| Modifier and Type | Field and Description |
|---|---|
static int |
CONVERTER_DEFAULT_PRIORITY
Default priority:
100 |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canConvert(Message<?> in,
Type target)
Checks whether this instance of converter can convert the given message
in into a Message<T> with
T being the type represented by target. |
Message<?> |
convert(Message<?> in,
Type target)
Converts the given message
in into a Message<T>. |
default int |
getPriority() |
static final int CONVERTER_DEFAULT_PRIORITY
100boolean canConvert(Message<?> in, Type target)
in into a Message<T> with
T being the type represented by target.
When reactive messaging looks for a converter, it picks the first converter returning true for a given
message.in - the input message, not nulltarget - the target type, generally the type ingested by a methodtrue if the conversion is possible, false otherwise.Message<?> convert(Message<?> in, Type target)
in into a Message<T>.
This method is only called after a successful call to canConvert(Message, Type) with the given target type.in - the input messagetarget - the target typedefault int getPriority()
getPriority in interface javax.enterprise.inject.spi.PrioritizedCopyright © 2018–2021 SmallRye. All rights reserved.