Spring 云任务
Spring CLoud Task
有没有办法将任务结果作为输入传递给其他任务,如下图所示。听起来很简单,但我在 Internet 上找不到任何东西。我不想使用队列或其他机制来执行此操作,我正在寻找任务 "native" 方式。
我找到了这个例子,我认为在这种情况下 strings 代表任务的输入,但我无法弄清楚如何生成输出以发送到下一个 task/s
@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));
}
}
}
在Spring云数据流中,您可以使用tasklauncher-dataflow out of the box stream sink
application. In your case, a task application can send the LaunchRequest to the tasklauncher-dataflow
sink application to launch the other task application with the given properties. You can find more detail on this here
有没有办法将任务结果作为输入传递给其他任务,如下图所示。听起来很简单,但我在 Internet 上找不到任何东西。我不想使用队列或其他机制来执行此操作,我正在寻找任务 "native" 方式。
我找到了这个例子,我认为在这种情况下 strings 代表任务的输入,但我无法弄清楚如何生成输出以发送到下一个 task/s
@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));
}
}
}
在Spring云数据流中,您可以使用tasklauncher-dataflow out of the box stream sink
application. In your case, a task application can send the LaunchRequest to the tasklauncher-dataflow
sink application to launch the other task application with the given properties. You can find more detail on this here