From 575c19fe2eb252271875eaeecd924e67fd2a1696 Mon Sep 17 00:00:00 2001 From: Soby Chacko Date: Mon, 12 Mar 2018 12:24:24 -0400 Subject: [PATCH] jdbc source sample changes --- sink-samples/jdbc-sink/README.adoc | 2 +- .../jdbc-source/src/main/java/demo/SampleJdbcSource.java | 1 + source-samples/jdbc-source/src/main/resources/application.yml | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sink-samples/jdbc-sink/README.adoc b/sink-samples/jdbc-sink/README.adoc index 69736cc..ca656e7 100644 --- a/sink-samples/jdbc-sink/README.adoc +++ b/sink-samples/jdbc-sink/README.adoc @@ -38,7 +38,7 @@ The following instructions assume that you are running Kafka and MySql as Docker When you start the app, it will create a table in the database. See the method annotated with`PostConstruct` in the application for more details. -* `java -jar target/sample-jdbc-sink-0.0.1-SNAPSHOT.jar` +* `java -jar target/jdbc-sink-0.0.1-SNAPSHOT.jar` The application has a convenient test source that sends to the same destination on the broker where the sink consumes data from. This test source will send some test records every second. diff --git a/source-samples/jdbc-source/src/main/java/demo/SampleJdbcSource.java b/source-samples/jdbc-source/src/main/java/demo/SampleJdbcSource.java index f35c7f2..027267a 100644 --- a/source-samples/jdbc-source/src/main/java/demo/SampleJdbcSource.java +++ b/source-samples/jdbc-source/src/main/java/demo/SampleJdbcSource.java @@ -52,6 +52,7 @@ import java.util.concurrent.TimeUnit; public class SampleJdbcSource { public static void main(String... args){ + SpringApplication.run(SampleJdbcSource.class, args); } diff --git a/source-samples/jdbc-source/src/main/resources/application.yml b/source-samples/jdbc-source/src/main/resources/application.yml index a82b8dd..92d2233 100644 --- a/source-samples/jdbc-source/src/main/resources/application.yml +++ b/source-samples/jdbc-source/src/main/resources/application.yml @@ -8,4 +8,6 @@ jdbc: query: select id, name, tag from test order by id triggerDelay: 5 spring.cloud.stream.bindings.output.destination: test-data -spring.cloud.stream.bindings.input.destination: test-data \ No newline at end of file +spring.cloud.stream.bindings.input.destination: test-data + +spring.cloud.stream.default.producer.partitionKeyExpression: '#{0}' \ No newline at end of file