Search code examples
javataskspring-cloud-dataflowspring-cloud-task

Spring CLoud Task


is there a way to pass an task result as input to other tasks, like in the image below. Sounds easy, but I can't find anything on the Internet. I don't want to use queues or other mechanisms to do this, Im looking for a task "native" way. enter image description here

I found this example, which I think it in this case strings represent the input for the task but I cant figure out how to produce the output to send to the next 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));
        }
    }
}

Solution

  • In Spring Cloud Data Flow, you can use the 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