Class MessageHandlerManager
java.lang.Object
com.inductiveautomation.ignition.common.script.message.MessageHandlerManager
Manages the lifecycle and execution of message handlers within a project.
-
Constructor Summary
ConstructorsConstructorDescriptionMessageHandlerManager(String projectName, ScriptManager manager, IScriptsEnabled scriptsEnabled, Map<MessageHandlerKey, String> messageHandlerScripts, boolean legacy) -
Method Summary
Modifier and TypeMethodDescriptionReturns a list of ScriptExecution reports, which gives the status of the last known state of all the message handlers.voidprocessMessage(String handlerName, org.python.core.PyDictionary messagePayload) Processes a message locally by invoking the specified message handler.voidprocessMessage(String handlerName, org.python.core.PyDictionary messagePayload, Properties filterParams) Runs the Jython script that is defined in the specified message handler of this client/gateway.voidprocessRequest(@NonNull String handlerName, @NonNull org.python.core.PyDictionary messagePayload, @Nullable MessageResultHandler resultHandler, @Nullable Properties filterParams) Runs the Jython script that is defined in the specified message handler of this client/gateway.voidprocessRequest(String handlerName, org.python.core.PyDictionary messagePayload, MessageResultHandler resultHandlers) Processes a request locally by invoking the specified message handler and returning the result through a result handler.voidreportExecution(MessageHandlerKey key, ScriptExecutionReport report) Called by MessageHanderRunnables every time one starts executing.voidshutdown()
-
Constructor Details
-
MessageHandlerManager
public MessageHandlerManager(String projectName, ScriptManager manager, IScriptsEnabled scriptsEnabled, Map<MessageHandlerKey, String> messageHandlerScripts, boolean legacy) - Parameters:
messageHandlerScripts- %lt;MessageHandlerKey, String scriptCode>
-
-
Method Details
-
processMessage
public void processMessage(String handlerName, org.python.core.PyDictionary messagePayload) throws MessageHandlerException Processes a message locally by invoking the specified message handler.- Parameters:
handlerName- The name of the message handler.messagePayload- The payload to deliver to the message handler.- Throws:
MessageHandlerException- if the handler cannot be found.
-
processMessage
public void processMessage(String handlerName, org.python.core.PyDictionary messagePayload, Properties filterParams) throws MessageHandlerException Runs the Jython script that is defined in the specified message handler of this client/gateway. If the message handler cannot be found, an error is thrown.- Parameters:
handlerName- is required. An exception is thrown if the message handler name is null or the specified handler does not exist.messagePayload- is required. Pass an empty dictionary if there are no parameters.filterParams- may be null. Used to transport zone/roles of originator- Throws:
MessageHandlerException- if message handler does not exist or required permissions not met.
-
processRequest
public void processRequest(String handlerName, org.python.core.PyDictionary messagePayload, MessageResultHandler resultHandlers) throws MessageHandlerException Processes a request locally by invoking the specified message handler and returning the result through a result handler.- Parameters:
handlerName- The name of the message handler.messagePayload- The payload to deliver to the message handler.resultHandlers- The handler to receive the result of the request.- Throws:
MessageHandlerException- if the handler cannot be found.
-
processRequest
public void processRequest(@NonNull String handlerName, @NonNull org.python.core.PyDictionary messagePayload, @Nullable MessageResultHandler resultHandler, @Nullable Properties filterParams) throws MessageHandlerException Runs the Jython script that is defined in the specified message handler of this client/gateway. If the request handler cannot be found, an error is thrown.- Parameters:
handlerName- is required. An exception is thrown if the message handler name is null or the specified handler does not exist.messagePayload- is required. Pass an empty dictionary if there are no parameters.resultHandler- may be null. Handles the request result.filterParams- may be null. Used to transport zone/roles of originator- Throws:
MessageHandlerException- if message handler does not exist or required permissions not met.
-
shutdown
public void shutdown() -
reportExecution
Called by MessageHanderRunnables every time one starts executing. By doing this, the user can later see the status of each handler. -
getScriptExecutionReports
Returns a list of ScriptExecution reports, which gives the status of the last known state of all the message handlers. -
getScriptDiagnostics
-