In this video, We will see why to use post client flow and how it will impact the performance of an API proxy if you would like to do some processing after sending the response back to the client in API flow.
Why PostClientFlow?
It’s implemented to improve the performance of Apigee API proxy. Before this flow, we use to send API Proxy data to analytics in Proxy Post flow. Ideally, this can be done even after sending the data to the client. Now, If you see data is send to AX in PostClientFlow.
How can I use PostClientFlow in my API Proxy?
For Message Logging using Message Logging Policy,
Similar to sending data to Analytics, you might be using message logging policy in API proxy to log proxy details to syslog / loggly / splunk.
If you are implementing message logging policy other than postlclientflow, it’s time to move that into postclientflow and improve performance
How to Add PostClientFlow to my API Proxy ?
PostClientFlow is supported only in Proxy Response Flow. You can add any policies related to post client flow only in response pipeline.
See example XML code below that goes into proxy xml,
Thank you for this informative post, @Anil Sagar– it’s very helpful. I had an important comment: seems I can only use message logging policy in postclientflow. I.e., your statement on allowing the following:
Implementing any functionality where you would like to process data after sending back response to the client.
looks to be incorrect. Only message logging is allowed. Please confirm, as there are others who are running into the same confusion.
@Anil Sagar - “Usage notes” section of “Message logging policy” says - “E**dge logs message asynchronously, meaning that no latency that might be caused by blocking callouts is introduced to your API.”
Is this true only when message logging policy is used inside Post Client Flow (as this video indicates), or it is asynchronous irrespective of location this policy is placed at?
@sanjeev kumar , Yes, I believe irrespective of location, Message logging policy logs message asynchronously. Time it takes to execute / invoke policy can be saved if same implemented in post client flow. It’s always recommended to implement same in POST Client Flow. @arghya das Is that how it works ? Correct me if i am wrong.
@Anil Sagar That’s right. The message logging does work asynchronously. But moving it to the post client flow makes it a fraction better since the client response is already sent so any delay in invoking the policy is outside of the actual request/response flow.
We have logging implemented in PostSlientFlow. Unfortunately, response body doesn’t seem to be available in this flow. Nothing gets printed to the log and trace shows that variable response.content is empty. Any idea how we could log response body? Thank you in advance!
I have a message logging policy in the post client flow. I want to write a response content which is sent to the client in the log. Do you know if apigee has any reference variable I can use in post client which gives the information? I used response.conetnt and message.content, both didn’t work.