From 09d090a43853d65bca924fa03e099c57bcb795c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=E5=98=89=E9=98=B3?= Date: Sun, 21 Feb 2021 11:41:54 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../top/fjy8018/consumer/ConsumerApplication.java | 2 +- .../src/main/resources/application.yml | 9 +++++++-- .../src/main/java/top/fjy8018/producer/Producer.java | 3 +-- .../src/main/resources/application.yml | 11 ++++++++--- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/consumer/consumer-server/src/main/java/top/fjy8018/consumer/ConsumerApplication.java b/consumer/consumer-server/src/main/java/top/fjy8018/consumer/ConsumerApplication.java index 60ed340..ebf2e52 100644 --- a/consumer/consumer-server/src/main/java/top/fjy8018/consumer/ConsumerApplication.java +++ b/consumer/consumer-server/src/main/java/top/fjy8018/consumer/ConsumerApplication.java @@ -15,7 +15,7 @@ public class ConsumerApplication { } @Bean - public Consumer receive() { + public Consumer sink1() { return System.out::println; } } diff --git a/consumer/consumer-server/src/main/resources/application.yml b/consumer/consumer-server/src/main/resources/application.yml index 038031b..0f0e5a9 100644 --- a/consumer/consumer-server/src/main/resources/application.yml +++ b/consumer/consumer-server/src/main/resources/application.yml @@ -3,10 +3,15 @@ spring: host: 192.168.133.128 username: dev-user password: devpassword + cloud: stream: bindings: - input: - destination: my-test-channel + sink1-in-0: + destination: test2 + function: + definition: sink1 + + server: port: 8081 \ No newline at end of file diff --git a/producer/producer-server/src/main/java/top/fjy8018/producer/Producer.java b/producer/producer-server/src/main/java/top/fjy8018/producer/Producer.java index 377e807..b147083 100644 --- a/producer/producer-server/src/main/java/top/fjy8018/producer/Producer.java +++ b/producer/producer-server/src/main/java/top/fjy8018/producer/Producer.java @@ -4,7 +4,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.stream.function.StreamBridge; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import top.fjy8018.consumer.common.MySource; import java.util.Date; @@ -20,7 +19,7 @@ public class Producer { @RequestMapping("/send") public String send() { - streamBridge.send(MySource.OUTPUT, new Date()); + streamBridge.send("source1-out-0", new Date()); return "success"; } diff --git a/producer/producer-server/src/main/resources/application.yml b/producer/producer-server/src/main/resources/application.yml index 5dc18c3..36d7825 100644 --- a/producer/producer-server/src/main/resources/application.yml +++ b/producer/producer-server/src/main/resources/application.yml @@ -3,10 +3,15 @@ spring: host: 192.168.133.128 username: dev-user password: devpassword + cloud: stream: bindings: - output: - destination: my-test-channel + source1-out-0: + destination: test2 + function: + definition: source1 + + server: - port: 8082 \ No newline at end of file + port: 8083 \ No newline at end of file