Skip to content
Visit booth 3171 at Google Cloud Next to see how to unlock real-time decisions at scaleMore info

Configure message format for Kafka outbound

The format section of the /etc/aerospike-kafka-outbound/aerospike-kafka-outbound.yml specifies the serialization format of the data output. The supported formats are:

Aerospike record metadata

The Aerospike record metadata has the following fields

MetadataTypeDescriptionPresent in
msgstringWrite/Delete command.Delete and Write
namespacestringNamespace of the Aerospike record.Delete and Write
setstringSet of the Aerospike record.Write
userKeylong, double, bytes or stringUser key of the Aerospike record.Write (only if user key is stored on server)
digestbytesDigest of the Aerospike record.Delete and Write
genintGeneration of the Aerospike record.Write
lutintLast update time of the Aerospike record.Write
expintExpiry of the Aerospike record.Write
durablebooleanWhether the delete is durable.Delete

Avro

Specifies that the data be serialized as Avro format. The Avro schema can be a map or a record. In the case of a map, just specifying the type of the map values is sufficient. In the case of a record, the exact field names and types need to be specified.

OptionRequiredDefaultExpected valueDescription
modeyesavroSelects Avro format.
schemanoSchema of the data.
schema-filenoFile containing the schema of the data.
stringify-map-keysnotrueWhether the numeric keys in CDT maps should be converted to strings. See Stringify Map Keys in Avro

One of schema or schema-file has to be specified.

Kafka Avro

Specifies that the data be serialized with KafkaAvroSerializer. The schema is expected to be maintained in a schema registry

OptionRequiredDefaultExpected valueDescription
modeyeskafka-avroSelects Kafka Avro format.
schemanoSchema of the data.
schema-filenoThe file containing the schema of the data.
registry-topicnoTopic name used to generate the schema name in the schema registry.
metadata-keynoMetadata will be inserted into this field of the record if specified, else metadata wont be included in writes.
propsyesMap of properties to initialize the KafkaAvroSerializer with. Valid values are as specified in KafkaAvroSerializerConfig.
stringify-map-keysnotrueWhether the numeric keys in CDT maps should be converted to strings. See Stringify Map Keys in Avro

The writes and deletes are written with different schemas. Since only a single schema can be registered with TopicNameStrategy for a topic, this conflicts with accommodating both write and delete schemas. Hence TopicNameStrategy strategy is disallowed for value.subject.name.strategy value in the props.

Flat JSON

Specifies that the data be serialized to Flat JSON format. The type information of bins is not part of the output.

OptionRequiredDefaultExpected valueDescription
modeyesflat-jsonSelects Flat JSON format.
metadata-keyyesAerospike record metadata will be inserted into this top level key.
stringify-map-keysnotrueWhether the numeric keys in CDT maps should be converted to strings. See Stringify Map Keys

Example

format:
mode: flat-json
metadata-key: metadata

JSON

Specifies that the data be serialized to JSON format with the type information of bins.

OptionRequiredDefaultExpected valueDescription
modeyesjsonSelects JSON format.
stringify-map-keysnotrueWhether the numeric keys in CDT maps should be converted to strings. See stringify map keys

Stringify Map Keys

Aerospike supports string, numeric types, and binary for map keys. JSON supports only string keys. If a map key is a numeric type and if stringify-map-keys is set to true, that key is converted to a string.

In all other cases, a map with non-string keys cannot be parsed by the connector, and the connector throws an error.

Example

format:
mode: json

MessagePack

Specifies that the data be serialized to MessagePack format with the type information of bins.

OptionRequiredExpected valueDescription
modeyesmessage-packSelects message pack format.

Example

format:
mode: message-pack

Custom

Specifies that the data be serialized with user-provided custom code. See Format Transform.

Example

format:
mode: custom
class: com.aerospike.connect.outbound.example.Formatter
Feedback

Was this page helpful?

What type of feedback are you giving?

What would you like us to know?

+Capture screenshot

Can we reach out to you?