Anil Sagar @ Google
suggested an idea ·
Mar 03, 2016 at 04:38 AM ·
1.1k Views
javascriptpost client flow
I Agree.
Most of the implementations have custom logging requirements and just message logging policy is not sufficient.
Message Logging policy is used along with JavaScript/Java policy to build the log message(in required format) and then passing the log message string to Message Logging policy. If JS policy is available in post client flow, it will definitely reduce the latency for API Request.
arghya das commented · Mar 05, 2016 at 05:04 AM
@Anil Sagar I am not sure what sort of a usecase you have in mind for javascript policy post client flow. The postclient flow was introduced so that, we can perform message logging without impacting the actual request response flow. I agree that we can leverage that for other things in the postclientflow, but remember that some of the context variables may not be available in the postclientflow, so having javascript support or other policies there would have limited functionality.
@arghya das, @Anil Sagar there is a real need of support of javascript in post client flow. Let me give you an example.
I want to log some details(timestamps) in the log file in ISO format. But all the timestamp variables doen't give the required details. So I have to add javascript to convert milisec to ISO format time. How can I achieve this without javascript support. Here is the list of variables i want log.
target.sent.end.timestamp
client.sent.end.timestamp
client.received.start.timestamp
target.received.start.timestamp
Let me know if you have any answer of this.
Thanks,
Krish
Add a JS policy in the PostFlow response
var start = context.getVariable('client.received.start.timestamp');
var end = context.getVariable('system.timestamp');
var processTime = Math.floor(end - start);
context.setVariable('processTime',processTime);
Help us make things better. Share your great idea or vote for other people's.