Using system.util.sendRequest with Redundant Gateways (Master/Backup)

Hi all,

I’m using the following function to send a message from an Edge Ignition gateway to a central Ignition gateway:

ack = system.util.sendRequest(
    project=project,
    messageHandler=globalMessage,
    payload=payload,
    remoteServer=gwName,
    timeout=15000
)

This works fine when the master gateway is up. But since the central has redundancy enabled, I’m wondering what happens when the master goes down.

  • Does sendRequest automatically fail over to the backup gateway, or do I need to handle that explicitly?

  • I tried enabling Request Failover on backup and calling the message, but I received this error:

com.inductiveautomation.ignition.client.gateway_interface.GatewayException: 
com.inductiveautomation.ignition.client.gateway_interface.GatewayException: 
TimeoutExpiredException[queueId=scriptMsgQueue, targetIntent=PLATFORM_SCRIPT_REQ, 
msgData=com.inductiveautomation.ignition.gateway.clientcomm.scriptmsg.RemoteScriptMsg@4550dcf5]

So I’m not sure:

  • Where is this message being queued?

  • Will it automatically retry when the master/connection is restored?

  • Or is there a way to explicitly send the request to the backup gateway?

Any advice or best practices for handling redundancy with system.util.sendRequest would be really helpful.

Thanks!

You could try using system.util.sendRequestAsync instead for your messaging which would allow you to do some error handling if you encounter any issues with failovers. If you receive an error, you could specifically target the backup gateway in your script (or something else useful).

Hi Daniel,

thanks for response. OK I will use async one and I am confused what will be remoteServer name in this case? Because Backup node has same name as Master.

I also tried adding 0:0 & 0:1, it didn’t work

The way the remote ids work is that if you just specify the remote gateway name without any _0:0 or _0:1 in front of it, is that the message routing system will route to whichever redundant gateway is active. If the redundant master gateway goes down, the local gateway is aware of this and will automatically reroute the message to the redundant backup gateway. (note that an address like _0:0:mygateway means that you are sending the message to either an independent gateway OR the currently active redundant gateway). You could route the message directly to the redundant master gateway using an address like _0:1:mygateway, or to the backup gateway using _0:2:mygateway. But if that gateway isn’t active, the message handler won’t respond anyway.

5 Likes

Hello the error I posted above was throwing when I used Remote Gateway Name without 0:1 & 0:2.

That’s what i too imagined that it would just work even though backup server is Master now but it didn’t. Because it wasn’t working hence I tried with 0:0 but that too failed anyway returning no gateway found or project not found something.

TimeoutExpiredException indicates that the message never made it to the remote gateway. Can you confirm that the remote gateway is available? You should be able to use the gateway network diagnostics page on the gateway to test for connectivity to the remote gateway.

Yes I see the remote gateway is available and can even access the gateway (from web browser) to see logs.

Just for reference:

I was missing Outgoing connection from Edge to Backup gateway hence it was failing. Following post helped:

Ignition Edge Gateway network setting on Redundancy - Ignition - Inductive Automation Forum