有一种方法可以将任务结果作为输入传递给其他任务,如下图所示。听起来很简单,但是我在互联网上找不到任何东西。我不想使用队列或其他机制来执行此操作,我正在寻找一种“本机”任务。
我找到了这个示例,在这种情况下,我认为它以字符串表示任务的输入,但是我无法弄清楚如何产生输出以发送到下一个任务
>@SpringBootApplication
public class SpringCloudTaskTestApplication {
public static void main(String[] args) {
SpringApplication.run(SpringCloudTaskTestApplication.class, args);
}
@Bean
public CommandLineRunner commandLineRunner() {
return new HelloWorldCommandLineRunner();
}
public static class HelloWorldCommandLineRunner implements CommandLineRunner {
@Override
public void run(String... strings) throws Exception {
System.out.println("TASK args: "+Arrays.toString(strings));
}
}
}
答案 0 :(得分:1)
在Spring Cloud Data Flow中,您可以使用tasklauncher-dataflow开箱即用的流sink
应用程序。在您的情况下,任务应用程序可以将LaunchRequest发送到tasklauncher-dataflow
接收器应用程序以启动具有给定属性的其他任务应用程序。您可以在此here