---
title: "Flat JSON format for Aerospike Kafka source (outbound) connector"
description: "Aerospike Kafka source (outbound) connector: Flat JSON data serialization format and message structure."
---

# Flat JSON format for Aerospike Kafka source (outbound) connector

> For the complete documentation index see: [llms.txt](https://aerospike.com/docs/llms.txt)
> 
> All documentation pages available in markdown.

This page specifies the Flat JSON data serialization format used by the Aerospike Kafka Source (Outbound) Connector. It describes how Aerospike notification messages are represented as Flat JSON objects. Each message represents an event that occurred in an Aerospike database cluster. Different kinds of messages are used to describe events such as record creation/update and record deletions.

## Key Format

The record key has the following properties

| Field | Type | Description |
| --- | --- | --- |
| `namespace` | string | Namespace of the Aerospike record. |
| `set` | string | Set of the Aerospike record. May be missing in some cases. |
| `userKey` | number, bytes (Base64 encoded) or string | The user key of the Aerospike record. Is available if user key is stored on the Aerospike server. |
| `digest` | bytes (Base64 encoded) | Digest of the Aerospike record. |

#### Example Key

```json
{

  "namespace": "users",

  "set": "premium",

  "userKey": "id123",

  "digest": "IBlTW5m3UGqbFxfrsoDxCrLkKYQ="

}
```

## Message Format

Each message is a JSON object with the metadata included in the specified `metadata-key` in the config and all the bins present as top level objects.

#### Message metadata

The message metadata properties are:

| Metadata | Type | Description |
| --- | --- | --- |
| `msg` | string | Write/Delete command. |
| `namespace` | string | Namespace of the Aerospike record. |
| `set` | string | Set of the Aerospike record. |
| `userKey` | long, double, bytes or string | User key of the Aerospike record. Present only if it is a write command and the user key is stored on the Aerospike server. |
| `digest` | bytes | Digest of the Aerospike record. |
| `gen` | int | Generation of the Aerospike record. |
| `lut` | long | Time when the record was last updated, in milliseconds since the Unix epoch. It is available whenever the Aerospike server ships last-update time. \[1\]\[2\] |
| `exp` | int | Time when the record will expire, in seconds since the Unix epoch. Zero means the record will not expire. Present only in write commands. |
| `durable` | boolean | Whether the delete is durable. Present only in delete commands. |

::: note
All metadata is affected by both delete and write commands, except where the description indicates otherwise.
:::

\[1\] When the Aerospike server does not ship `lut`, Aerospike Kafka source (outbound) connector versions earlier than 4.0.0 ship `lut` as zero.

\[2\] **Breaking Change** When the Aerospike server ships `lut`, Aerospike Kafka source (outbound) connector versions earlier than 4.0.0 ship `lut` as a value of the data type “integer”.

#### Example Write Message

Record with bins color and size.

```json
{

    "metadata": {

        "msg": "write",

        "namespace": "users",

        "set": "premium",

        "userKey": 7612,

        "gen": 4,

        "lut": 1617167159548,

        "digest": "IBlTW5m3UGqbFxfrsoDxCrLkKYQ=",

        "exp": 1682797792

    },

    "color": "red",

    "size": 123

}
```

#### Example Delete Message

```json
{

    "metadata": {

        "msg": "delete",

        "namespace": "users",

        "set": "premium",

        "digest": "IBlTW5m3UGqbFxfrsoDxCrLkKYQ=",

        "gen": 4,

        "lut": 1617167159548,

        "durable": false

    }

}
```