public interface RecordTranslator<K,V> extends Serializable, Func<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>,List<Object>>
Translate a ConsumerRecord
to a tuple.
Modifier and Type | Field and Description |
---|---|
static List<String> |
DEFAULT_STREAM |
Modifier and Type | Method and Description |
---|---|
List<Object> |
apply(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> record)
Translate the ConsumerRecord into a list of objects that can be emitted.
|
Fields |
getFieldsFor(String stream)
Get the fields associated with a stream.
|
default List<String> |
streams()
Get the list of streams this translator will handle.
|
List<Object> apply(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> record)
Translate the ConsumerRecord into a list of objects that can be emitted.
apply
in interface Func<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>,List<Object>>
record
- the record to translateKafkaTuple
if you want to route the tuple to a non-default stream. Return null
to discard an invalid ConsumerRecord
if KafkaSpoutConfig.Builder.setEmitNullTuples(boolean)
is set to false
.Fields getFieldsFor(String stream)
Get the fields associated with a stream. The streams passed in are returned by the streams()
method.
stream
- the stream the fields are forCopyright © 2022 The Apache Software Foundation. All rights reserved.