Payload for the Kafka message
As with all other transports, the translation between EPL events and Kafka payloads is based on the choice of host plug-in and codecs. See
Host plug-ins and configuration and
Codec Connectivity Plug-ins for further information.
The default payload for the Kafka message is a string (with conversion from the underlying bytes using the classes StringDeserializer and StringSerializer from the org.apache.kafka.common.serialization package).
The following is a simple example of a YAML configuration file where the payload of the Kafka message will be the string form of the Apama event:
dynamicChainManagers:
kafkaManager:
transport: kafkaTransport
managerConfig:
bootstrap.servers: "localhost:9092"
dynamicChains:
myChain:
- apama.eventString:
- kafkaTransport:
You can configure alternative serializers and deserializers using the
consumerConfig and
producerConfig options of the Kafka connectivity plug-in (see also
Configuring the connection to Kafka (dynamicChainManagers). You can use a third-party serializer/deserializer implementation or you can create your own. You just need to include the relevant classes in the same classpath of the Kafka plug-in itself so that it can locate them. See the Kafka documentation for more information about Kafka serializers and deserializers. Additional transformations (for example, from a string containing JSON to a map) can be performed after the Kafka transport using connectivity codec plug-ins.