Class ConsumerRecordConverter
- java.lang.Object
-
- io.smallrye.reactive.messaging.kafka.converters.ConsumerRecordConverter
-
- All Implemented Interfaces:
MessageConverter
,javax.enterprise.inject.spi.Prioritized
@ApplicationScoped public class ConsumerRecordConverter extends Object implements MessageConverter
Convert an incoming Kafka message into aConsumerRecord
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.smallrye.reactive.messaging.MessageConverter
MessageConverter.IdentityConverter
-
-
Field Summary
-
Fields inherited from interface io.smallrye.reactive.messaging.MessageConverter
CONVERTER_DEFAULT_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description ConsumerRecordConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canConvert(Message<?> in, Type target)
Checks whether this instance of converter can convert the given messagein
into aMessage<T>
withT
being the type represented bytarget
.Message<?>
convert(Message<?> in, Type target)
Converts the given messagein
into aMessage<T>
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.smallrye.reactive.messaging.MessageConverter
getPriority
-
-
-
-
Method Detail
-
canConvert
public boolean canConvert(Message<?> in, Type target)
Description copied from interface:MessageConverter
Checks whether this instance of converter can convert the given messagein
into aMessage<T>
withT
being the type represented bytarget
. When reactive messaging looks for a converter, it picks the first converter returningtrue
for a given message.- Specified by:
canConvert
in interfaceMessageConverter
- Parameters:
in
- the input message, notnull
target
- the target type, generally the type ingested by a method- Returns:
true
if the conversion is possible,false
otherwise.
-
convert
public Message<?> convert(Message<?> in, Type target)
Description copied from interface:MessageConverter
Converts the given messagein
into aMessage<T>
. This method is only called after a successful call toMessageConverter.canConvert(Message, Type)
with the given target type.- Specified by:
convert
in interfaceMessageConverter
- Parameters:
in
- the input messagetarget
- the target type- Returns:
- the converted message.
-
-