|
1 | 1 | = Kafka Source Connector: Payload Mode Configuration |
2 | 2 | :page-role: new-5.1.5 |
3 | 3 |
|
4 | | -The Kafka Source Connector for Neo4j supports two payload modes to control the format of data serialized and published to Kafka topics: `EXTENDED` and `COMPACT`. This feature is configurable through the `neo4j.payload-mode` property, allowing users to select the preferred serialization format based on data requirements. |
| 4 | +The Kafka Source Connector for Neo4j supports three payload modes to control the format of data serialized and published to Kafka topics: `EXTENDED`, `COMPACT` and `RAW_JSON_STRING`. |
| 5 | +This feature is configurable through the `neo4j.payload-mode` property, allowing users to select the preferred serialization format based on data requirements. |
5 | 6 |
|
6 | 7 | == Payload Modes |
7 | 8 |
|
8 | 9 | The `neo4j.payload-mode` configuration offers the following options: |
9 | 10 |
|
10 | | -* **`EXTENDED` (Default)**: Provides a detailed structure for each property, supporting schema compatibility and consistency. This format is especially useful in cases where schema changes (such as property type changes) or temporal types are present, ensuring data consistency across changes. |
| 11 | +* **`EXTENDED` (Default)**: Provides a detailed structure for each property, supporting schema compatibility and consistency. |
| 12 | +This format is especially useful in cases where schema changes (such as property type changes) or temporal types are present, ensuring data consistency across changes. |
11 | 13 |
|
12 | | -* **`COMPACT`**: Produces a simpler format that only includes the essential fields. This format is lighter and may be preferable when schema compatibility or complex data types are not required. |
| 14 | +* **`COMPACT`**: Produces a simpler format that only includes the essential fields. |
| 15 | +This format is lighter and may be preferable when schema compatibility or complex data types are not required. |
| 16 | + |
| 17 | +* **`RAW_JSON_STRING`**: Produces a raw JSON string representation of the data. |
| 18 | +This mode is useful for scenarios where you generate complex data structures using xref:source/query.adoc[] which are not easily represented in the `EXTENDED` or `COMPACT` modes. |
| 19 | +*Only available when using xref:source/query.adoc[] strategy.* |
13 | 20 |
|
14 | 21 | [WARNING] |
15 | 22 | ==== |
16 | 23 | *Limitations of `COMPACT` Mode* |
17 | 24 |
|
18 | | -* **Property Type Changes**: `COMPACT` mode does not support changes in property types. If a property type changes in Neo4j (e.g., from integer to string), it can break the schema. |
19 | | -* **Protobuf Compatibility**: `COMPACT` mode is not supported with Protobuf. It does not support serialization of temporal types (e.g., `LocalDate`, `LocalDateTime`). |
| 25 | +* **Property Type Changes**: `COMPACT` mode does not support changes in property types. |
| 26 | +If a property type changes in Neo4j (e.g., from integer to string), it can break the schema. |
| 27 | +
|
| 28 | +* **Protobuf Compatibility**: `COMPACT` mode is not supported with Protobuf. |
| 29 | +It does not support serialization of temporal types (e.g., `LocalDate`, `LocalDateTime`). |
20 | 30 | ==== |
21 | 31 |
|
22 | 32 |
|
@@ -141,7 +151,8 @@ This mode is especially beneficial for data with complex schema requirements, as |
141 | 151 |
|
142 | 152 | == Understanding the `EXTENDED` Payload Structure |
143 | 153 |
|
144 | | -In `EXTENDED` mode, each property includes fields for every supported Neo4j type. Only the field corresponding to the actual property type will contain a non-null value, while all others are set to null. This structure ensures that any change in the type of a property does not cause schema enforcement errors at either the source or sink connector. |
| 154 | +In `EXTENDED` mode, each property includes fields for every supported Neo4j type. Only the field corresponding to the actual property type will contain a non-null value, while all others are set to null. |
| 155 | +This structure ensures that any change in the type of a property does not cause schema enforcement errors at either the source or sink connector. |
145 | 156 |
|
146 | 157 | [cols="1,2"] |
147 | 158 | |=== |
@@ -179,8 +190,11 @@ For example, a string field will be represented as: |
179 | 190 |
|
180 | 191 | == Configuration Recommendations |
181 | 192 |
|
182 | | -`COMPACT` mode is useful and easier to work with when generated messages are consumed with other connectors or applications, and you can relax your schema compatibility mode on target topics. If your environment requires schema compatibility, temporal data types, or you have strong type safety requirements with different converters (`AVRO`, `JSON Schema`, `PROTOBUF` or `JSON Embedded`), `EXTENDED` mode should be preferred. |
| 193 | +`COMPACT` mode is useful and easier to work with when generated messages are consumed with other connectors or applications, and you can relax your schema compatibility mode on target topics. |
| 194 | +If your environment requires schema compatibility, temporal data types, or you have strong type safety requirements with different converters (`AVRO`, `JSON Schema`, `PROTOBUF` or `JSON Embedded`), `EXTENDED` mode should be preferred. |
183 | 195 |
|
184 | 196 | == Compatibility with Sink Connectors |
185 | 197 |
|
186 | | -The `EXTENDED` format was introduced in connector version 5.1.0 to ensure that all data published to Kafka topics adheres to a consistent schema. This prevents issues when a property changes type on the Neo4j side (e.g., a name property changes from integer to string), enabling smooth data processing across connectors and Kafka consumers. When a Neo4j sink connector is fed by a Neo4j source connector, it’s recommended to use `EXTENDED` mode, as the Neo4j sink connector can seamlessly handle the `EXTENDED` data type. |
| 198 | +The `EXTENDED` format was introduced in connector version 5.1.0 to ensure that all data published to Kafka topics adheres to a consistent schema. |
| 199 | +This prevents issues when a property changes type on the Neo4j side (for example, a name property changes from integer to string), enabling smooth data processing across connectors and Kafka consumers. |
| 200 | +Use the `EXTENDED` mode when a Neo4j sink connector is fed by a Neo4j source connector, as the Neo4j sink connector can seamlessly handle the `EXTENDED` data type. |
0 commit comments