Executing different step in shared flow depending on where the shared flow is getting called Target EndPoint or Proxy end point

Not applicable

I got Shared flow which has two steps, I want to execute one step if the sf is getting called from proxy end point and the other step if the call is coming from target end point.

What is the condition, I should use for this.

May be something like policy.callOut.Location=TargetEndPoint.. I am not sure. Please let em know if there is any way to do this.

I can go for two diff shared flow and achieve this but wanted to do this one place for optimum codes.

@Sudhee Sreedhara @Dino @Anil Sagar @AMAR DEVEGOWDA

If I use it in error fault rules then can I use the error.state like we get in APIgee trace T/F conditions.

Solved Solved
1 2 663
1 ACCEPTED SOLUTION

Within a step (like a JS step, Java callout, Python, AssignMessage/AssignVariable, etc), you can read the variable currentstep.flowstate to detect the state in which the step is running. That context variable will return one of these values:

  • PROXY_REQ_FLOW
  • TARGET_REQ_FLOW
  • TARGET_RESP_FLOW
  • PROXY_RESP_FLOW

..depending on where in the flow the step is attached.

There is one exception: Policies executing within a shared flow that read currentstep.flowstate always get "SHARED_FLOW", regardless of where the shared flow is attached. This is a known issue: b/66214414

There is a workaround for JS steps in particular - https://community.apigee.com/answers/47224/view.html

Does this help?

View solution in original post

2 REPLIES 2

Within a step (like a JS step, Java callout, Python, AssignMessage/AssignVariable, etc), you can read the variable currentstep.flowstate to detect the state in which the step is running. That context variable will return one of these values:

  • PROXY_REQ_FLOW
  • TARGET_REQ_FLOW
  • TARGET_RESP_FLOW
  • PROXY_RESP_FLOW

..depending on where in the flow the step is attached.

There is one exception: Policies executing within a shared flow that read currentstep.flowstate always get "SHARED_FLOW", regardless of where the shared flow is attached. This is a known issue: b/66214414

There is a workaround for JS steps in particular - https://community.apigee.com/answers/47224/view.html

Does this help?

Thank you @Dino for the quick answer. Appreciate it!!

I would try it out.

If I use the sf for error handling then can use error.state as my goto variable.

<Condition>(((error.state === TARGET_REQ_FLOW) or (error.state === TARGET_RESP_FLOW)) or ((error.state === REQ_SENT) or (error.state === RESP_START)))</Condition>