多主题配置
This commit is contained in:
@@ -18,4 +18,9 @@ public class ConsumerApplication {
|
|||||||
public Consumer<Date> sink1() {
|
public Consumer<Date> sink1() {
|
||||||
return System.out::println;
|
return System.out::println;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Consumer<String> sink2() {
|
||||||
|
return System.out::println;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,10 @@ spring:
|
|||||||
bindings:
|
bindings:
|
||||||
sink1-in-0:
|
sink1-in-0:
|
||||||
destination: test2
|
destination: test2
|
||||||
|
sink2-in-0:
|
||||||
|
destination: test3
|
||||||
function:
|
function:
|
||||||
definition: sink1
|
definition: sink1;sink2
|
||||||
|
|
||||||
|
|
||||||
server:
|
server:
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ 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 java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -17,10 +19,16 @@ public class Producer {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private StreamBridge streamBridge;
|
private StreamBridge streamBridge;
|
||||||
|
|
||||||
@RequestMapping("/send")
|
@RequestMapping("/send1")
|
||||||
public String send() {
|
public String send1() {
|
||||||
streamBridge.send("source1-out-0", new Date());
|
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";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,10 @@ spring:
|
|||||||
bindings:
|
bindings:
|
||||||
source1-out-0:
|
source1-out-0:
|
||||||
destination: test2
|
destination: test2
|
||||||
|
source2-out-0:
|
||||||
|
destination: test3
|
||||||
function:
|
function:
|
||||||
definition: source1
|
definition: source1;source2
|
||||||
|
|
||||||
|
|
||||||
server:
|
server:
|
||||||
|
|||||||
Reference in New Issue
Block a user