Skip to content

Commit

Permalink
Starting new code for Producer (#38)
Browse files Browse the repository at this point in the history
* StreamsEventMetaBuilder implemented
* Add unit tests for beforeCommit
* Add unit tests for beforeCommit
* PreviousTransactionDataBuilder
* Filled transaction data into meta
* moved RoutingConfigurationConstants into KafkaConfiguration
  • Loading branch information
omarlarus authored and jexp committed Oct 15, 2018
1 parent d171db9 commit a290940
Show file tree
Hide file tree
Showing 34 changed files with 2,158 additions and 432 deletions.
2 changes: 1 addition & 1 deletion doc/asciidoc/producer/data/node.created.json
Expand Up @@ -11,7 +11,7 @@
}
},
"payload": {
"id": 1004,
"id": "1004",
"type": "node",
"after": {
"labels": ["Person"],
Expand Down
2 changes: 1 addition & 1 deletion doc/asciidoc/producer/data/node.deleted.json
Expand Up @@ -11,7 +11,7 @@
}
},
"payload": {
"id": 1004,
"id": "1004",
"type": "node",
"before": {
"labels": ["Person"],
Expand Down
2 changes: 1 addition & 1 deletion doc/asciidoc/producer/data/node.updated.json
Expand Up @@ -11,7 +11,7 @@
}
},
"payload": {
"id": 1004,
"id": "1004",
"type": "node",
"before": {
"labels": ["Person", "Tmp"],
Expand Down
14 changes: 7 additions & 7 deletions doc/asciidoc/producer/data/relationship.created.json
Expand Up @@ -11,20 +11,20 @@
}
},
"payload": {
"id": 123,
"id": "123",
"type": "relationship",
"name": "KNOWS",
"label": "KNOWS",
"after": {
"properties": {
"since": "2018-04-05T12:34:00[Europe/Berlin]"
},
"startNode": {
"start": {
"labels": ["Person"],
"id": 123
"id": "123"
},
"endNode": {
"end": {
"labels": ["Person"],
"id": 456
"id": "456"
}
}
},
Expand All @@ -35,4 +35,4 @@
}
}
}
}
}
14 changes: 7 additions & 7 deletions doc/asciidoc/producer/data/relationship.deleted.json
Expand Up @@ -11,21 +11,21 @@
}
},
"payload": {
"id": 123,
"id": "123",
"type": "relationship",
"name": "KNOWS",
"label": "KNOWS",
"before": {
"properties": {
"since": "2018-04-05T12:34:00[Europe/Berlin]",
"to": "2019-04-05T23:00:00[Europe/Berlin]"
},
"startNode": {
"start": {
"labels": ["Person"],
"id": 123
"id": "123"
},
"endNode": {
"end": {
"labels": ["Person"],
"id": 456
"id": "456"
}
}
},
Expand All @@ -37,4 +37,4 @@
}
}
}
}
}
22 changes: 11 additions & 11 deletions doc/asciidoc/producer/data/relationship.updated.json
Expand Up @@ -11,34 +11,34 @@
}
},
"payload": {
"id": 123,
"id": "123",
"type": "relationship",
"name": "KNOWS",
"label": "KNOWS",
"before": {
"properties": {
"since": "2018-04-05T12:34:00[Europe/Berlin]"
},
"startNode": {
"start": {
"labels": ["Person"],
"id": 123
"id": "123"
},
"endNode": {
"end": {
"labels": ["Person"],
"id": 456
"id": "456"
}
},
"after": {
"properties": {
"since": "2018-04-05T12:34:00[Europe/Berlin]",
"to": "2019-04-05T23:00:00[Europe/Berlin]"
},
"startNode": {
"start": {
"labels": ["Person"],
"id": 123
"id": "123"
},
"endNode": {
"end": {
"labels": ["Person"],
"id": 456
"id": "456"
}
}
},
Expand All @@ -55,4 +55,4 @@
}
}
}
}
}
43 changes: 18 additions & 25 deletions doc/asciidoc/producer/index.adoc
Expand Up @@ -19,11 +19,14 @@ kafka.reindex.batch.size=1000
kafka.session.timeout.ms=15000
kafka.connection.timeout.ms=10000
kafka.replication=1
kafka.linger.ms=1
kafka.transaction.id=
kafka.topics=neo4j
kafka.patterns=neo4j:*
kafka.routing.nodes.<TOPIC_NAME>=<PATTERN>
----

Note: To use the Kafka transactions please set `kafka.transaction.id` and `kafka.acks` properly

See the https://kafka.apache.org/documentation/#brokerconfigs[Apache Kafka documentation] for details on these settings.

=== Patterns
Expand All @@ -37,35 +40,25 @@ Patterns are separated by semicolons `;`.
The basic syntax is:

----
kafka.topics=topic1,topic2
kafka.patterns=topic1:*;topic2:Label1{prop1, prop2}, topic1:Label1:Label2{*,-prop1}, topic2:Label3{-prop1,-prop2,prop3}
Label{*};Label1{prop1, prop2};Label3{-prop1,-prop2}
----

[cols="1m,3a",opts=header]
|===
| pattern
| meaning

| topic:*
| all nodes go to this topic

| topic:Label
| all nodes with this label with all their properties go to this topic

| topic:Label{*}
| all nodes with this label with all their properties go to this topic
| Label{*}
| all nodes with this label with all their properties go to the related topic

| topic:Label1:Label2
| nodes with these two labels are sent to this topic
| Label1:Label2
| nodes with these two labels are sent to the related topic

| topic1:Label1;topic2:Label2
| nodes with Label1 are sent to topic1, nodes with Label2 are sent to topic2
| Label{prop1,prop2}
| the prop1, prop2 of all nodes with this label are sent to the related topic

| topic:Label{prop1,prop2}
| the prop1, prop2 of all nodes with this label are sent to the topic

| topic:Label{-prop1,-prop2}
| properties of the node with prop1, prop2 excluded, with the label are sent to the topic
| Label{-prop1,-prop2}
| properties of the node with prop1, prop2 excluded, with the label are sent to the related topic

|===

Expand Down Expand Up @@ -222,19 +215,19 @@ We must distinguish two cases:
|Type
|Description

|*type*
|*label*
|string
|The relationship type

|*properties*
|Map<K,V>
|List of properties attached to the relationship, the Key is the property name

|*startNode*
|*start*
|Object
|The starting node of the relationship

|*endNode*
|*end*
|Object
|The ending node of the relationship
|===
Expand Down Expand Up @@ -325,7 +318,7 @@ A node can have a list of constraints attached to it:
|The label attached to the constraint

|*type*
|enum["NODE_KEY", "UNIQUENESS"]
|enum["NODE_KEY", "UNIQUENESS", "RELATIONSHIP_PROPERTY_EXISTENCE", "NODE_PROPERTY_EXISTENCE"]
|The contraint type

|*properties*
Expand Down
16 changes: 12 additions & 4 deletions pom.xml
Expand Up @@ -28,11 +28,11 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<kotlin.version>1.1.51</kotlin.version>
<kotlin.version>1.2.70</kotlin.version>
<neo4j.version>3.4.7</neo4j.version>
<kafka.version>1.0.1</kafka.version>
<spring-kafka.version>2.1.4.RELEASE</spring-kafka.version>
<kotlin.compiler.incremental>true</kotlin.compiler.incremental>
<kotlin.coroutines.version>true</kotlin.coroutines.version>
</properties>

<organization>
Expand Down Expand Up @@ -117,9 +117,14 @@
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jre8</artifactId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-core</artifactId>
<version>0.30.2</version>
</dependency>

<!-- test dependencies -->
<dependency>
Expand Down Expand Up @@ -197,7 +202,6 @@
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>

<executions>
<execution>
<id>compile</id>
Expand All @@ -213,13 +217,17 @@
</goals>
</execution>
</executions>
<configuration>
<jvmTarget>1.8</jvmTarget>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
<configuration>
<includes>
<include>**/*Test.*</include>
<include>**/*IT.*</include>
</includes>
</configuration>
</plugin>
Expand Down
18 changes: 0 additions & 18 deletions producer/src/main/kotlin/kafka/GraphRecords.kt

This file was deleted.

76 changes: 0 additions & 76 deletions producer/src/main/kotlin/kafka/KafkaConfiguration.kt

This file was deleted.

0 comments on commit a290940

Please sign in to comment.