I want to create a Shared Flow that puts something in the cache and makes a call to slack, but depending on given parameters the text in the call to slack and the key for the cache should be different.
I've looked at http://docs.apigee.com/api-services/reference/flow-callout-policy but I haven't seen how to add a variable.
Can I use <AssignVariable> like in the Assign Message Policy?
Solved! Go to Solution.
FYI,
Apigee has added an enhancement to the FlowCallout to allow explicit parameterization of the callout. The reference is b/74750586 .
Usage is like this:
<FlowCallout name="FC-MySharedFlow"> <Parameters> <Parameter name="input1" value='FOO'/> <Parameter name="input2" ref='request.header.bar'/> <Parameter name="destination">FOO</Parameter> <Parameter name="tmplvalue">{request.header.foo}</Parameter> </Parameters> <SharedFlowBundle>MySharedFlow</SharedFlowBundle> </FlowCallout>
The effect is that the execution of the sharedflow will begin with a new set of context variables, corresponding to the set of Parameter elements. They're just normal context variables, so within policies inside the sharedflow, you can access those context variables as you would normally. Eg., in a JavaScript policy within MySharedFlow you could
var input1 = context.getVariable("input1"); var destination = context.getVariable("destination"); var value = context.getVariable('tmplvalue'); context.setVariable(destination, value.toLowerCase());
As you can see from the sample configuration, there are a number of options for specifying the value for each Parameter.
If you repeat a Parameter name, the behavior is not defined.
Special note: If context variables with those names already exist , they are temporarily overwritten with new values. When the SharedFlow completes, the former values of these context variables are restored.
I'll link to the official documentation when it becomes available.
This should be available in the cloud soon.
This isn't a huge new feature, but it is a nice ease-of-use thing. It will make it easier to explicitly see the intended inputs to a FlowCallout invocation.