6

I want to execute my apps using spring-complex-task and I have already build complex spring-batch Flow Jobs which executes perfectly fine.

could you please explain what is difference between spring Batch flow job Vs spring composed task? and which is best among them?

2 Answers2

7

A composed task within Spring Cloud Data Flow is actually built on Spring Batch in that the transition from task to task is managed by a dynamically generated Spring Batch job. This model allows the decomposition of a batch job into reusable parts that can be independently tested, deployed, and orchestrated at a level higher than a job. This allows for things like writing a single step job that is reusable across multiple workflows.

They are really complimentary. You can use a composed task within Spring Cloud Data Flow to orchestrate both Spring Cloud Tasks as well as Spring Batch jobs (run as tasks). It really depends on how you want to slice up your process. If you have processes that are tightly coupled, package them as a single job. From there, you can orchestrate them with Spring Cloud Data Flow's composed task functionality.

Michael Minella
  • 20,843
  • 4
  • 55
  • 67
  • to follow up to this question/answer so if we were to split existing spring batch jobs with multiple steps to say as you say single "Job1step1" tasks. Is there a pricing difference on PCF to running such jobs? So for instance, instead of running a single long running job with multiple steps on a single node now it is divided among say 100 short lived task/batch nodes in a composed task that need to created -> do work -> destroyed in PCF. – Selwyn Jul 05 '17 at 05:13
  • I wouldn't be able to comment on pricing since I don't know the details. I'd recommend working with your sales team to confirm. – Michael Minella Jul 06 '17 at 05:15
  • okay i'll follow up with somebody in sales. I guess what I was trying to ask was not necessarily specific pricing information but rather "how tasks are billed" on PCF? Is each task execution instance billed by the first hr regardless of run duration or are they billed by run duration? I think it is relevant to this topic because I agree with your answer regarding the benefits of composed tasks but do the costs / economies of such a solution make sense? In that 1 long running job+steps instance vs 100 composed tasks example I cited. – Selwyn Jul 06 '17 at 10:55
  • @Selwyn, Feel free to contact me offline and I can share my understanding. – Michael Minella Jul 06 '17 at 14:53
3

In general, there's not one that's "better". It's going to be dependent on your use case and requirements.

Spring Batch is a nice framework to run batch processing applications.

Spring Cloud Task is a wrapper that allows you to run short lived microservices using Spring Cloud along with Spring Boot. Once you setup a test with @EnableTask it will then launch your *Runner. The framework also comes with Spring Batch integration points and ComposedTaskRunner helps facilitate that integration.

I'd start with the Spring Cloud Task batch documentation and then come back to ask more specific questions.

Dean Clark
  • 3,770
  • 1
  • 11
  • 26