How to retrieve target server value in policies

 

How can I retrieve the target server value in a JS/Assign Message policy

 

 

<HTTPTargetConnection>
   <LoadBalancer>
      <Server name="server"/>
   </LoadBalancer>
</HTTPTargetConnection>

 

 

 

0 5 305
5 REPLIES 5

I don't know if it is possible. @kurtkanaskie or @ssvaidyanathan do either of you know for certain? 

I am not aware either

Here is what you can do when you run a test and trace the traffic you will see the variables but such variables are little interesting (if not visible) you could download the trace session and check for the variable.For your question the answer is below.

context.getVariable("loadbalancing.targetserver")

 

I was able to print the target server name and the target IP address (resolved IP) by using the following variables

 

print(context.getVariable("loadbalancing.targetserver"));
print(context.getVariable("targetendpoint_default.resolvedAddress"));

 

And this gets populated only in the response flow after the call is made to the target.

Please bear in mind that the variable name uses the name of your TargetEndpoint. In my case its "default", hence the variable name is "targetendpoint_default.resolvedAddress"

Thanks everyone