配置改进

This commit is contained in:
2021-02-21 11:41:54 +08:00
parent 1b8e541d68
commit 09d090a438
4 changed files with 17 additions and 8 deletions

View File

@@ -15,7 +15,7 @@ public class ConsumerApplication {
} }
@Bean @Bean
public Consumer<Date> receive() { public Consumer<Date> sink1() {
return System.out::println; return System.out::println;
} }
} }

View File

@@ -3,10 +3,15 @@ spring:
host: 192.168.133.128 host: 192.168.133.128
username: dev-user username: dev-user
password: devpassword password: devpassword
cloud: cloud:
stream: stream:
bindings: bindings:
input: sink1-in-0:
destination: my-test-channel destination: test2
function:
definition: sink1
server: server:
port: 8081 port: 8081

View File

@@ -4,7 +4,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.function.StreamBridge; import org.springframework.cloud.stream.function.StreamBridge;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import top.fjy8018.consumer.common.MySource;
import java.util.Date; import java.util.Date;
@@ -20,7 +19,7 @@ public class Producer {
@RequestMapping("/send") @RequestMapping("/send")
public String send() { public String send() {
streamBridge.send(MySource.OUTPUT, new Date()); streamBridge.send("source1-out-0", new Date());
return "success"; return "success";
} }

View File

@@ -3,10 +3,15 @@ spring:
host: 192.168.133.128 host: 192.168.133.128
username: dev-user username: dev-user
password: devpassword password: devpassword
cloud: cloud:
stream: stream:
bindings: bindings:
output: source1-out-0:
destination: my-test-channel destination: test2
function:
definition: source1
server: server:
port: 8082 port: 8083