Spring Cloud Data Flow多个输入输出

时间:2019-07-05 15:35:37

标签: java spring-boot spring-kafka spring-cloud-stream spring-cloud-dataflow

我正在尝试创建一个接受输入一个参数的PROCESSOR,我希望它产生多个输出,在本例中为两个。我已经用costum接口定义了它

public interface MyProcessor {

    String INPUT = "myInput";

    @Input
    SubscribableChannel myInput();

    @Output("myOutput")
    MessageChannel anOutput();

    @Output
    MessageChannel anotherOutput();
}

比这样的应用程序逻辑,只需返回输入参数

@SpringBootApplication
@EnableBinding(MyProcessor.class)
public class SpringDataFlowAppApplication {

     Logger logger = LoggerFactory.getLogger(SpringDataFlowAppApplication.class);


    @Autowired
    private MyProcessor processor;

    public static void main(String[] args) {
        SpringApplication.run(SpringDataFlowAppApplication.class, args);
    }

    @StreamListener(MyProcessor.INPUT)
    public void routeValues(String val) {

        processor.anOutput().send(MessageBuilder.withPayload(val).build());
        processor.anotherOutput().send(MessageBuilder.withPayload(val).build());

        logger.debug("SpringDataFlowAppApplication --> "+val);
    }
}

现在的问题是,如何在此输出中连接其他两个处理器,如图所示。我想并行化一些进程(PROC_!和PROC_2)。对于使用SpringCloudDataFlow Console的部署Im,如下图所示 enter image description here

0 个答案:

没有答案