Package io.smallrye.reactive.messaging
Interface MessageConverter
- 
- All Superinterfaces:
- javax.enterprise.inject.spi.Prioritized
 - All Known Implementing Classes:
- ConsumerRecordConverter,- ConsumerRecordsConverter,- 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 SummaryNested Classes Modifier and Type Interface Description static classMessageConverter.IdentityConverter
 - 
Field SummaryFields Modifier and Type Field Description static intCONVERTER_DEFAULT_PRIORITYDefault priority:100
 - 
Method SummaryAll 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_PRIORITYstatic final int CONVERTER_DEFAULT_PRIORITY Default priority:100- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
canConvertboolean 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, not- null
- target- the target type, generally the type ingested by a method
- Returns:
- trueif the conversion is possible,- falseotherwise.
 
 - 
convertMessage<?> 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 message
- target- the target type
- Returns:
- the converted message.
 
 - 
getPrioritydefault int getPriority() - Specified by:
- getPriorityin interface- javax.enterprise.inject.spi.Prioritized
 
 
- 
 
-