How to execute flow before some other flows, not all

Not applicable

Hi everybody again. I have 5 flows in my system. One of them call validation. I need to execute validation flow before two other flows. And left 2 flows should be without validation. Can I insert one flow in another, or what is the best practice in APIGEE?

0 2 548
2 REPLIES 2

Not applicable

@Oleksandr Skoryi

,

Typically we refer to them as Conditional Flow, where in each of the flows would be executed based on meeting some specific condition. Example could be "if the URL path contains word validation and if the request verb is POST, then execute validation flow". So, we can achieve this by trying something similar to :

<Flows>

<Flow name=“CallValidation”>

<Description>CallValidation</Description>

<Request>

<Step>

<Name>Policy 1</Name>

</Step>

<Step>

<Name>Policy 2</Name>

</Step>

<Step>

<Name>Policy 3</Name>

</Step>

<Step>

<Name>Policy 4</Name>

</Step>

</Request>

<Response>

</Response>

<Condition>(proxy.pathsuffix MatchesPath “validation”) and (request.verb =“POST”)</Condition>

</Flow>

Now, if you have same condition but you wanted to put some higher priority on one, then one more practice is to put form parameter in the condition.

Also, if there is no specific form parameter, then you place the flow that you wanted to execute on top of the flows. Like if I want flow 2 to be executed before flow 1 and 3, then do something like this:

<Flows>

<Flow name=“Flow 2”>

<Description>CallValidation</Description>

<Request>

</Step>

</Request>

<Response>

</Response>

<Condition>(proxy.pathsuffix MatchesPath “validation”) and (request.verb =“POST”)</Condition>

</Flow>

<Flow name=“Flow 1”>

<Description>CallValidation</Description>

<Request>

<Step>

<Name>Policy 1</Name>

</Step>

</Request>

<Response>

</Response>

<Condition>(proxy.pathsuffix MatchesPath “validation”) and (request.verb =“POST”)</Condition>

</Flow>

<Flow name=“Flow 3”>

<Description>CallValidation</Description>

<Request>

<Step>

<Name>Policy 4</Name>

</Step>

</Request>

<Response>

</Response>

<Condition>(proxy.pathsuffix MatchesPath “validation”) and (request.verb =“POST”)</Condition>

</Flow>

</Flows>

Not applicable

Simple Answer is that you can have only one conditional flow run per request.

Complex Answer:

If you want to run another flow or segment your activities in flows you would have to use the new proxy chaining feature.

http://docs.apigee.com/api-services/content/connecting-proxies-other-proxies

This will allow you to have common workflows segmented to other other proxies without incurring the latency cost of another network call.