What you will have to do is dispatch the message using MessageDispatchManager, and then you need to set up a message handler in a project that can call a script function in your module (example shown below).
Send code (Java):
MessageDispatchManager mdm = gatewayContext.getMessageDispatchManager();
PyDictionary payload = new PyDictionary(new PyObject[] {
new PyString("Source"), new PyString("Gateway"),
new PyString("Message"), new PyString("testMessage")
});
// Limit to Gateway scope
Properties filterParams = new Properties();
filterParams.setProperty(MessageDispatchManager.KEY_SCOPE, MessageDispatchManager.SCOPE_GATEWAY_ONLY);
// You must specify a project, as message handlers are configured in projects.
mdm.dispatch("MyProject",
"MyMessageHandler",
payload,
filterParams);
Jython Message handler in a project, which must be named “MyMessageHandler”:
def handleMessage(payload):
mymodule.myFunction(payload)