Package io.smallrye.reactive.messaging
Interface MessageConverter
- 
- All Superinterfaces:
 javax.enterprise.inject.spi.Prioritized
- All Known Implementing Classes:
 ConsumerRecordConverter,MessageConverter.IdentityConverter,RecordConverter
@Experimental("SmallRye only feature") public interface MessageConverter extends javax.enterprise.inject.spi.PrioritizedConverter transformingMessage<A>intoMessage<B>. To register a converter, expose a, generallyApplicationScopedbean, implementing this interface.When multiple converters are available, implementation should override the
getPriority()method. The default priority isCONVERTER_DEFAULT_PRIORITY. Converters with higher priority are executed first. 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classMessageConverter.IdentityConverter 
- 
Field Summary
Fields Modifier and Type Field Description static intCONVERTER_DEFAULT_PRIORITYDefault priority:100 
- 
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleancanConvert(Message<?> in, Type target)Checks whether this instance of converter can convert the given messageininto aMessage<T>withTbeing the type represented bytarget.Message<?>convert(Message<?> in, Type target)Converts the given messageininto aMessage<T>.default intgetPriority() 
 - 
 
- 
- 
Field Detail
- 
CONVERTER_DEFAULT_PRIORITY
static final int CONVERTER_DEFAULT_PRIORITY
Default priority:100- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
canConvert
boolean canConvert(Message<?> in, Type target)
Checks whether this instance of converter can convert the given messageininto aMessage<T>withTbeing the type represented bytarget. When reactive messaging looks for a converter, it picks the first converter returningtruefor a given message.- Parameters:
 in- the input message, notnulltarget- the target type, generally the type ingested by a method- Returns:
 trueif the conversion is possible,falseotherwise.
 
- 
convert
Message<?> convert(Message<?> in, Type target)
Converts the given messageininto aMessage<T>. This method is only called after a successful call tocanConvert(Message, Type)with the given target type.- Parameters:
 in- the input messagetarget- the target type- Returns:
 - the converted message.
 
 
- 
getPriority
default int getPriority()
- Specified by:
 getPriorityin interfacejavax.enterprise.inject.spi.Prioritized
 
 - 
 
 -