Details how to use shared flows for establishing a common error handling routine for all proxies.
Shared Flow
- Zip the "sharedflowbundle" folder
- Upload as a Shared Flow (APIs-->Shared Flows)
- Deploy to environment needed
- Customize to add additional error codes, error handling, logging, etc
Example Proxy
- Zip the "apiproxy"
- Upload the proxy
- Deploy to environment needed
Test
- Import "errorhandlingexample-sharedflow-proxy-v1.postman_collection.json" into Postman
- Run calls to see response
Proxy Template With Shared Flow Reference
- This is the proxy template (referenced here: https://github.com/davidmehi/edge-proxy-template) that now uses the shared flow for common error handling.
To use the Shared Flow in a proxy:
- Add the shared flow "SharedFlow_FaultRulesHanding" using the Shared Flow policy to the proxy.
- Add the policy to the <FaultRules> and the <DefaultFaultRule> in the default.xml of the proxy. In both cases, the shared flow will be called, which contains the common error handling logic.
<FaultRules>
<FaultRule name="Shared Fault Rules">
<Step>
<Name>FlowCalloutFaultRulesHandling</Name>
</Step>
</FaultRule>
<!-- could put additional fault rules here if needed -->
</FaultRules>
<DefaultFaultRule name="all">
<AlwaysEnforce>true</AlwaysEnforce>
<Step>
<Name>FlowCalloutFaultRulesHandling</Name>
</Step>
</DefaultFaultRule>