I just found some more time to tinker with this.
This is my full example of the GatewayHook
package org.example;
import com.inductiveautomation.ignition.common.licensing.LicenseState;
import com.inductiveautomation.ignition.gateway.clientcomm.ClientReqSession;
import com.inductiveautomation.ignition.gateway.model.AbstractGatewayModuleHook;
import com.inductiveautomation.ignition.gateway.model.GatewayContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class GatewayHook extends AbstractGatewayModuleHook {
private final Logger logger = LoggerFactory.getLogger(getClass());
@Override
public void setup(GatewayContext gatewayContext) {
logger.info("Setup GatewayHook");
}
@Override
public void startup(LicenseState licenseState) {
logger.info("Starting GatewayHook");
}
@Override
public void shutdown() {
}
@Override
public Object getRPCHandler(ClientReqSession session, String projectName) {
logger.info("getRPCHandler called");
return new ModuleRPCImpl();
}
}
I see both the setup and the startup methods are called, however, the getRPCHandler
method is never called.Not on startup and not when I call a script that should go over RPC.
The RPC implementation is just this from the tutorial:
package org.example;
public class ModuleRPCImpl implements ModuleRPC {
public String getGreeting(String firstName){
return "Hello, " + firstName;
}
}
I really have no idea what I should do with that “projectName
” string, certainly not for this example that should hold for all projects, and if the getRPCHandler
method doesn’t even get called.