0

I am trying spring cloud function with aws lambda. Lets say, I have 5 different spring function (A,B,C,D,E) and function composition of like this A|B|C|D|E.

I specify which function to invoke using spring_cloud_function_definition in lambda, so, spring_cloud_function_definition = A|B|C|D|E

Now, i want to route to other function (lets say F), from function A in certain scenario (lets say, on receive of some error code while executing in A) and not move to next functions in function composition.

What i would like to know:

  1. Is it possible to end execution in this function composition in middle based on certain parameters.? If yes, How do i achieve.

    I tried MessgaeRoutingCallback but its not working for me. I created a class that implements MessgaeRoutingCallback. I returned "F" in functiondefinition. I tried to call this functiondefinition from function "A".

On execution of composition,it goes like this A -> functiondefinition (does not route to F) -> B ->C->D->E

1 Answers1

2

Once again, (as it is explained here and in the previous post here some time back) composed function is not a chain or flow or a pipeline of any kind. It is a single function created using andThen or compose methods of Java Function. It is as if you wrote a single function yourself combining the functionality of all 5 functions. So the real question should be "how do you stop execution of a single function in the middle of its execution?"

Oleg Zhurakousky
  • 5,820
  • 16
  • 17