This page applies to Apigee and Apigee hybrid.
View
Apigee Edge documentation.
Use the FlowCallout
policy to call out to a shared flow from either an API proxy or another
shared flow.
In a shared flow, you create a sequence of steps that you can reuse at run time from multiple
places. These steps are implemented as policies, as within an API proxy. The FlowCallout
policy
gives you a way to invoke the shared flow from API proxies and other shared flows.
It works like a function call in a traditional programming language.
- For example, imagine that you've built a shared flow with security features such as
API key verification, OAuth token validation, and regular expression protection. This shared flow
represents your convention for a way to check inbound requests.
Using the
FlowCallout
policies, you can invoke that shared flow from multiple API proxies. - You can call one shared flow from another by implementing a
FlowCallout
policy from within a shared flow.
This policy is an Extensible policy and use of this policy might have cost or utilization implications, depending on your Apigee license. For information on policy types and usage implications, see Policy types.
Samples
Element reference
Following are elements and attributes you can configure on this policy:
<FlowCallout async="false" continueOnError="false" enabled="true" name="Flow-Callout-1"> <DisplayName>Custom label used in UI</DisplayName> <SharedFlowBundle>thereferencedsharedflowbundle</SharedFlowBundle> </FlowCallout>
<FlowCallout> attributes
<FlowCallout async="false" continueOnError="false" enabled="true" name="Flow-Callout-1">
The following table describes attributes that are common to all policy parent elements:
Attribute | Description | Default | Presence |
---|---|---|---|
name |
The internal name of the policy. The value of the Optionally, use the |
N/A | Required |
continueOnError |
Set to Set to |
false | Optional |
enabled |
Set to Set to |
true | Optional |
async |
This attribute is deprecated. |
false | Deprecated |
<DisplayName> element
Use in addition to the name
attribute to label the policy in the
management UI proxy editor with a different, natural-language name.
<DisplayName>Policy Display Name</DisplayName>
Default |
N/A If you omit this element, the value of the policy's |
---|---|
Presence | Optional |
Type | String |
<SharedFlowBundle> element
Specifies the name of the shared flow to call. This element's value should be the same as the
value of the target <SharedFlowBundle>
element's name attribute.
<SharedFlowBundle/>
In the simplest example, you give the name of the shared flow being called as a value for this
element. That is, this element's value must be the same as the shared flow's name
attribute value.
<SharedFlowBundle>Shared-Flow-Name</SharedFlowBundle>
Default | N/A |
---|---|
Presence | Required |
Type | N/A |
Attributes
None.
<Parameter> element
Specifies a parameter and value (or value source) to pass as a variable into the shared flow called by this policy.
By using a parameter, you can specify a value (or a variable containing a value) that should be
passed to the shared flow called by the policy. This is conceptually similar to specifying a
parameter in a function call. As with a function parameter, a FlowCallout
parameter's value can
vary based on the context of the shared flow call.
FlowCallout
parameters are visible only during the shared flow's execution.
You can use this element with any one of the following syntax forms. Note that where you use a literal value, the format of the value you specify will depend on the code that consumes it.
<!- A literal value in an attribute. --/> <Parameter name="parameter-name" value='parameter-value' /> <!- A reference to a variable in an attribute. --/> <Parameter name="parameter-name" ref='source-variable-name' /> <!- A literal value in the element content. --/> <Parameter name="parameter-name">parameter-value</Parameter> <!- An reference to an attribute in the element content. --/> <Parameter name="parameter-name">{source-variable-name}</Parameter>
This String-Handler
FlowCallout
policy passing parameters that specify where
to store the shared flow's output and what input to use. The Parameter
elements
specify the names and values of variables to create runtime. The shared flow can retrieve
these variables for use in its own code.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <FlowCallout async="false" continueOnError="false" enabled="true" name="String-Handler"> <DisplayName>String Handler</DisplayName> <Parameters> <Parameter name="input">Gladys Kravitz</Parameter> <Parameter name="outputVariable">string.handler.output</Parameter> </Parameters> <SharedFlowBundle>StringHandler</SharedFlowBundle> </FlowCallout>
Default | N/A |
---|---|
Presence | Required |
Type | N/A |
Attributes
Attribute | Description | Default | Presence | Type |
---|---|---|---|---|
name |
The name of the runtime variable to create with this parameter. | None | Required | String |
ref |
The variable that contains the value to use at runtime. Omit this attribute if you're specifying a literal value to use. |
None | Optional | String |
value |
The value to use in the runtime variable created with this parameter. Omit this attribute if you're specifying the name of a variable that should be the value source. | None | Optional | String |
<Parameters> element
Specifies the set of <Parameter> elements to pass as variables into the shared flow called by this policy.
<Parameters> <Parameter name="parameter-name" value='parameter-value' /> </Parameters>
Default | N/A |
---|---|
Presence | Optional |
Type | N/A |
Attributes
None.
Schemas
Flow variables
Flow variables enable dynamic behavior of policies and flows at runtime, based on HTTP headers, message content, or flow context. For more information about Flow variables, see Variables reference.
Variable | Description |
---|---|
|
Scope: During the shared flow execution The value of the shared flow's name attribute. |
|
Scope: During execution of the shared flow attached to the flow
hook. The name of the flow hook. |
Error reference
This section describes the fault codes and error messages that are returned and fault variables that are set by Apigee when this policy triggers an error. This information is important to know if you are developing fault rules to handle faults. To learn more, see What you need to know about policy errors and Handling faults.
Runtime errors
These errors can occur when the policy executes.
Fault code | HTTP status | Cause | Fix |
---|---|---|---|
flow.SharedFlowNotFound |
500 |
Either the shared flow does not exist, or the shared flow exists but is not deployed. | build |
Deployment errors
N/A
Related topics
- Creating shared flows: Reusable shared flows
- Executing shared flows across multiple proxies: Attaching a shared flow using a flow hook