Flowhooks: can I add only 1 SharedFlow to a flowhook ?

hi,

can I configure only 1 hook in by example preflow or post flow?

I was hoping hook was something like an interceptor where you can define

ValidateThing1();

ValidateThing2();

ValidateThing3();

ValidateResponse1();

ValidateResponseCase2();

ValidateAllErrorResponses();

from the hooks configuration it seems I only can add 1 shared flow in the hook not 2, 3

is my observation correct ?

thank you

Solved Solved
0 2 279
1 ACCEPTED SOLUTION

Correct. You can attach at most one shared flow to each of 4 distinct flowhooks.

The documentation on flow hooks states this, but not as clearly as we might hope.

We'll get that clarified.

Getting back to your question, I think your actual goal is not "attach more than one shared flow" but "allow a configurable sequence of operations".

The way to do this is perhaps to have a single sharedflow configured as a flowhook at the stage you prefer, and then within that sharedflow, you can configure FlowCallout policies to call to other sharedflows.

You can compose these SharedFlows as you wish.

So your sharedflow might include FlowCallout policies pointing to other SharedFlows that do "validateThing1" "validateThing2", and so on.

View solution in original post

2 REPLIES 2

Correct. You can attach at most one shared flow to each of 4 distinct flowhooks.

The documentation on flow hooks states this, but not as clearly as we might hope.

We'll get that clarified.

Getting back to your question, I think your actual goal is not "attach more than one shared flow" but "allow a configurable sequence of operations".

The way to do this is perhaps to have a single sharedflow configured as a flowhook at the stage you prefer, and then within that sharedflow, you can configure FlowCallout policies to call to other sharedflows.

You can compose these SharedFlows as you wish.

So your sharedflow might include FlowCallout policies pointing to other SharedFlows that do "validateThing1" "validateThing2", and so on.

sounds good, so the hook will have a global sharedHook, and internally i can use my mini checks