1

Is it possible to create a custom Exit status in spring cloud data flow?

Let's say i have the following: enter image description here

I saw an examples for FAILED and UNKNOWN, so I've created 2 custom conditions Worked & Generated. Assuming this approach is possible - How do i pass those strings from inside the task? Or it needs to be passed from somewhere else? If not - then why i can write any string that i want in the "Properties for TRANSITION" modal?

Fima Taf
  • 929
  • 9
  • 22

1 Answers1

2

Other than providing the UI option to wire the exit-code to map to a particular downstream step, there's nothing dynamically influenced by SCDF. In other words, SCDF doesn't interfere with whatever is happening internally in each Task application.

The custom transitions require the desired exit-codes to be returned/handled within the Task application itself.

In your example above, if the Timestamp's business logic returned "Worked" as the exit-code, then the transition would result in executing Bar application. Likewise, if the exit-code is "Generated", you'd see Foo running.

Sabby Anandan
  • 5,636
  • 2
  • 12
  • 21
  • But where and how (in the code itself) i can return those values? The 'Task' is basically a spring boot app with a 'main' method (which is void), and the task bean is a 'run' method (which is also void), so how do i pass this value from inside the `Timestamp` app to the 'orchestra tor' app? – Fima Taf Nov 21 '19 at 08:08
  • 1
    First, of all, you need to read more about [how exit-message works](https://docs.spring.io/spring-cloud-task/docs/current/reference/htmlsingle/#features-task-execution-listener-exit-messages) in Spring Cloud Task. Also, read more about how these [maps to exit-status](https://docs.spring.io/spring-cloud-dataflow/docs/2.2.2.RELEASE/reference/htmlsingle/#_exit_statuses) in SCDF. – Sabby Anandan Nov 21 '19 at 21:17
  • 1
    Of course, the stock `timestamp` app that we ship won't magically work with whatever transition you are wanting to explore. You need to build a custom task app to add and map your "custom" exit-message to whatever you want, and then build the composed task graph in SCDF to create the transitions. Again, it has to be done in your app. – Sabby Anandan Nov 21 '19 at 21:18
  • 1
    The CTR expert in the team pointed me to his end-to-end sample that demonstrates the exit-message functionality, locally and also in SCDF. See: https://github.com/cppwfs/funwithctr – Sabby Anandan Nov 21 '19 at 21:21
  • Thank you @Shabby Anandan for the explanations, this was very helpful, and it did solved my issue :) – Fima Taf Nov 24 '19 at 20:35