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 ebf2e52..2abc2f4 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 @@ -18,4 +18,9 @@ public class ConsumerApplication { public Consumer sink1() { return System.out::println; } + + @Bean + public Consumer sink2() { + 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 0f0e5a9..856bc8d 100644 --- a/consumer/consumer-server/src/main/resources/application.yml +++ b/consumer/consumer-server/src/main/resources/application.yml @@ -9,8 +9,10 @@ spring: bindings: sink1-in-0: destination: test2 + sink2-in-0: + destination: test3 function: - definition: sink1 + definition: sink1;sink2 server: 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 b147083..e760990 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 @@ -5,6 +5,8 @@ import org.springframework.cloud.stream.function.StreamBridge; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.Date; /** @@ -17,10 +19,16 @@ public class Producer { @Autowired private StreamBridge streamBridge; - @RequestMapping("/send") - public String send() { + @RequestMapping("/send1") + public String send1() { streamBridge.send("source1-out-0", new Date()); - return "success"; + return "success1"; + } + + @RequestMapping("/send2") + public String send2() { + streamBridge.send("source2-out-0", LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)); + return "success2"; } } diff --git a/producer/producer-server/src/main/resources/application.yml b/producer/producer-server/src/main/resources/application.yml index 36d7825..b90191c 100644 --- a/producer/producer-server/src/main/resources/application.yml +++ b/producer/producer-server/src/main/resources/application.yml @@ -9,8 +9,10 @@ spring: bindings: source1-out-0: destination: test2 + source2-out-0: + destination: test3 function: - definition: source1 + definition: source1;source2 server: