Policies allowed in a shared flow called from PostClientFlow ?

anoopgupta
Participant I

Hi All,

I've created a shared flow for message logging and I'm calling it from PostClientFlow. In the trace i can see that the shared flow and its policies (a JS for creating a log message and a MessageLogging to log into ELK) are getting executed. But from phase details I dont see any variable from JS being created.

To Debug when I tried putting a print() command in the JS, i dont get anything in the trace tool's output window. If I place the same JS anywhere else in the proxy flow the print() works, which means the JS is fine.

Is JS not allowed in the shared flow which is to be used in the PostClientFlow ?

9155-capture.png

0 8 684
8 REPLIES 8

sidd-harth
Participant V

Only MessageLogging policies can be attached to PostClientFlow.

I would suggest you use only JS in shared flow and use a Flowhook or add it manually in any endpoint. In PostCLientFlow only add the MessageLogging Policy.

@Anoop Gupta It depends on the version you are currently using, in the latest version 4.19.01.00 we also have an option to include the message logging shared flow in postclientflow. We will be able to see the logs successfully with this approach also.

Hi @Siva Kumar Nasimsetty , Yes i'm using the latest version 4.19.01 . I've created another shared flow for log message creation and removed the JS from the message logging shared flow , and that works.

So is this conclusion correct : Shared flow called in PostClientFlow can only have MessageLogging Policy ?

9160-capture2.png

@Siddharth Barahalikar

What about CoRs?

We want to add it to every proxy by default.

So we are planning to keep at post client flow with a shared flow

And that shared flow will have cors and message logging policies

Can we have this approach?

@Anoop Gupta , we can use policies also in shared flow that is being called from postclientflow. Based on your requirements you can form the log message using assign message, JavaScript etc in the shared flow.

@Siva Kumar Nasimsetty , tried putting the JS and AM policies back in the shared flow that is being called from PostClientFlow. Upon execution , the policies seems to be executing but I dont see any of their Variables in the Phase details, ex.the logData which is formed in the AM policy or the proxyDuration calculated in JS. Also tried putting print() in JS but dont see any of its output in "Output from all Transactions". This is same state as mentioned in my first post.

9161-capture3.png

this is the JS

9162-capture4.png

@anoop Gupta , please verify the logs from the log server and confirm. We tried this approach and we are able to see the logs in log server.

@Siva Kumar Nasimsetty , I logged the message into Loggly and can confirm that when we try to form the message in the shared flow AM policy called in postclient flow , that message is not getting created.

9163-capture5.png

Whereas if I'm creating the log message earlier in the flow and passing to postclient flow message logging policy, then it works.

9164-capture6.png