Send RESTMessageV2 through a MID Server Cluster

EdwinCoronado
ServiceNow Employee
ServiceNow Employee

Hello,

I know it's possible to do something such as

var request = new sn_ws.RESTMessageV2();
request.setEndpoint('https://google.com');
request.setHttpMethod('get');
request.setMIDServer('MID SERVER NAME');
var response = request.execute();
gs.info(response.getBody());

Where request.setMIDServer('MID SERVER NAME') is used to send the message through a MID server. However, I have a MID Server Cluster with multiple MID servers and I would rather send to the cluster than to a specific MID server. Is this possible? 

Thanks,

-Edwin

1 ACCEPTED SOLUTION

ARG645
Tera Guru

edwin,

Sending the REST API through a Mid server that belongs to a cluster will do the Job. Meaning the below code  will handle the cluster.

request.setMIDServer('MID SERVER NAME');

Below is the reason: 

When you set the Mid Server for the REST API in the code and execute, what really happens behind the scenes is: 

1.  A new entry to the ECC Queue will be made for your REST API call with topic "RESTProbe"

2.  A business rule named "MID Server Cluster Management" will check if the assigned mid server is down or  if its failed in upgrade. And it will take care of assigning another mid server in the cluster.

 

Thank you,

Aman Gurram

View solution in original post

2 REPLIES 2

ARG645
Tera Guru

edwin,

Sending the REST API through a Mid server that belongs to a cluster will do the Job. Meaning the below code  will handle the cluster.

request.setMIDServer('MID SERVER NAME');

Below is the reason: 

When you set the Mid Server for the REST API in the code and execute, what really happens behind the scenes is: 

1.  A new entry to the ECC Queue will be made for your REST API call with topic "RESTProbe"

2.  A business rule named "MID Server Cluster Management" will check if the assigned mid server is down or  if its failed in upgrade. And it will take care of assigning another mid server in the cluster.

 

Thank you,

Aman Gurram

EdwinCoronado
ServiceNow Employee
ServiceNow Employee

Thanks! I cracked open that Business Rule and I see that what you're saying is correct.