From 45db7c0f31008b875036508329d6aad5d7faa3ae Mon Sep 17 00:00:00 2001 From: Ali Ince Date: Fri, 27 Jun 2025 20:12:51 +0100 Subject: [PATCH] fix: raw string configuration --- .../docker-data/source.cdc.json-schema.json | 30 +++++++++++++++++++ .../docker-data/source.query.json-schema.json | 21 +++++++++++++ .../docker-data/source.query.json-string.json | 4 +-- modules/ROOT/pages/source/cdc.adoc | 11 +++++++ modules/ROOT/pages/source/query.adoc | 23 ++++++++++---- 5 files changed, 81 insertions(+), 8 deletions(-) create mode 100644 modules/ROOT/examples/docker-data/source.cdc.json-schema.json create mode 100644 modules/ROOT/examples/docker-data/source.query.json-schema.json diff --git a/modules/ROOT/examples/docker-data/source.cdc.json-schema.json b/modules/ROOT/examples/docker-data/source.cdc.json-schema.json new file mode 100644 index 0000000..984d126 --- /dev/null +++ b/modules/ROOT/examples/docker-data/source.cdc.json-schema.json @@ -0,0 +1,30 @@ +{ + "name": "Neo4jSourceConnectorJSONSchema", + "config": { + "connector.class": "org.neo4j.connectors.kafka.source.Neo4jConnector", + "key.converter": "org.apache.kafka.connect.json.JsonConverter", + "key.converter.schemas.enable": true, + "value.converter": "org.apache.kafka.connect.json.JsonConverter", + "value.converter.schemas.enable": true, + "neo4j.uri": "neo4j://neo4j:7687", + "neo4j.authentication.type": "BASIC", + "neo4j.authentication.basic.username": "neo4j", + "neo4j.authentication.basic.password": "password", + "neo4j.source-strategy": "CDC", + "neo4j.start-from": "NOW", + "neo4j.cdc.poll-interval": "1s", + "neo4j.cdc.poll-duration": "5s", + "neo4j.cdc.topic.my-topic.patterns.0.pattern": "(:Person)", + "neo4j.cdc.topic.my-topic.patterns.0.operation": "create", + "neo4j.cdc.topic.my-topic.patterns.0.changesTo": "name,surname", + "neo4j.cdc.topic.my-topic.patterns.0.metadata.authenticatedUser": "neo4j", + "neo4j.cdc.topic.my-topic.patterns.0.metadata.executingUser": "neo4j", + "neo4j.cdc.topic.my-topic.patterns.0.metadata.txMetadata.app": "sales", + "neo4j.cdc.topic.my-topic.patterns.1.pattern": "(:Person)-[:KNOWS]->(:Person)", + "neo4j.cdc.topic.my-topic.patterns.1.operation": "update", + "neo4j.cdc.topic.my-topic.patterns.1.changesTo": "since", + "neo4j.cdc.topic.my-topic.patterns.1.metadata.authenticatedUser": "neo4j", + "neo4j.cdc.topic.my-topic.patterns.1.metadata.executingUser": "neo4j", + "neo4j.cdc.topic.my-topic.patterns.1.metadata.txMetadata.app": "sales" + } +} \ No newline at end of file diff --git a/modules/ROOT/examples/docker-data/source.query.json-schema.json b/modules/ROOT/examples/docker-data/source.query.json-schema.json new file mode 100644 index 0000000..b73016e --- /dev/null +++ b/modules/ROOT/examples/docker-data/source.query.json-schema.json @@ -0,0 +1,21 @@ +{ + "name": "Neo4jSourceConnectorJSONString", + "config": { + "connector.class": "org.neo4j.connectors.kafka.source.Neo4jConnector", + "key.converter": "org.apache.kafka.connect.json.JsonConverter", + "key.converter.schemas.enable": true, + "value.converter": "org.apache.kafka.connect.json.JsonConverter", + "value.converter.schemas.enable": true, + "neo4j.uri": "neo4j://neo4j:7687", + "neo4j.authentication.type": "BASIC", + "neo4j.authentication.basic.username": "neo4j", + "neo4j.authentication.basic.password": "password", + "neo4j.source-strategy": "QUERY", + "neo4j.start-from": "NOW", + "neo4j.query": "MATCH (ts:TestSource) WHERE ts.timestamp > $lastCheck RETURN ts.name AS name, ts.surname AS surname, ts.timestamp AS timestamp", + "neo4j.query.streaming-property": "timestamp", + "neo4j.query.topic": "test-source", + "neo4j.query.polling-interval": "1s", + "neo4j.query.polling-duration": "5s" + } +} \ No newline at end of file diff --git a/modules/ROOT/examples/docker-data/source.query.json-string.json b/modules/ROOT/examples/docker-data/source.query.json-string.json index 1b7c064..2efc7cd 100644 --- a/modules/ROOT/examples/docker-data/source.query.json-string.json +++ b/modules/ROOT/examples/docker-data/source.query.json-string.json @@ -2,9 +2,9 @@ "name": "Neo4jSourceConnectorJSONString", "config": { "connector.class": "org.neo4j.connectors.kafka.source.Neo4jConnector", - "key.converter": "org.apache.kafka.connect.storage.StringConverter", + "key.converter": "org.apache.kafka.connect.json.JsonConverter", "key.converter.schemas.enable": false, - "value.converter": "org.apache.kafka.connect.storage.StringConverter", + "value.converter": "org.apache.kafka.connect.json.JsonConverter", "value.converter.schemas.enable": false, "neo4j.uri": "neo4j://neo4j:7687", "neo4j.authentication.type": "BASIC", diff --git a/modules/ROOT/pages/source/cdc.adoc b/modules/ROOT/pages/source/cdc.adoc index 0cf0220..d831953 100644 --- a/modules/ROOT/pages/source/cdc.adoc +++ b/modules/ROOT/pages/source/cdc.adoc @@ -96,6 +96,17 @@ include::example$docker-data/source.cdc.protobuf.json[] ---- ===== +[.include-with-JSON-messages-with-embedded-schema] +===== +ifdef::backend-pdf[] +.source.cdc.protobuf.json +endif::[] +[source,json] +---- +include::example$docker-data/source.cdc.json-schema.json[] +---- +===== + ==== We will now create the source instance by invoking the following REST call: diff --git a/modules/ROOT/pages/source/query.adoc b/modules/ROOT/pages/source/query.adoc index f31b731..025d96a 100644 --- a/modules/ROOT/pages/source/query.adoc +++ b/modules/ROOT/pages/source/query.adoc @@ -53,25 +53,36 @@ include::example$docker-data/source.query.json.json[] ---- ===== -[.include-with-JSON-messages-as-string] +[.include-with-PROTOBUF-messages] ===== ifdef::backend-pdf[] -.source.query.json-string.json +.source.query.protobuf.json endif::[] [source,json] ---- -include::example$docker-data/source.query.json-string.json[] +include::example$docker-data/source.query.protobuf.json[] ---- ===== -[.include-with-PROTOBUF-messages] +[.include-with-JSON-messages-with-embedded-schema] ===== ifdef::backend-pdf[] -.source.query.protobuf.json +.source.query.json-schema.json endif::[] [source,json] ---- -include::example$docker-data/source.query.protobuf.json[] +include::example$docker-data/source.query.json-schema.json[] +---- +===== + +[.include-with-JSON-messages-as-string] +===== +ifdef::backend-pdf[] +.source.query.json-string.json +endif::[] +[source,json] +---- +include::example$docker-data/source.query.json-string.json[] ---- =====