Continue to Run a Script Started by a Client After the Client Closes


I am building a program in Ignition which will allow users to create multiple reports, merge them together, email them, and save them to locations on the office network. Some of these reports take a significant amount of time to process, even when I apply multithreading. I want users to be able to create their report, check a box to indicate they want to save it somewhere on the network, close the client, and then have that report continue to be built on a separate thread and delivered to their requested location when completed.

Is there any way I can setup my reporting scripts, so that a user can start building a report in a client, close the client, and then still have that report be built and either saved to the network or emailed?

Use system.util.sendMessage() to take your user’s request and pass it to your gateway, then let the message handler on your gateway start an asynchronous thread to do all the work. The only possible hitch is that destination folders / network resources must be reachable from the gateway.

If you’re running 7.8 or later, you can use to do this. The request is sent to the gateway and completed there, so long-running reports should finish even if the client is shut down.

The only down side would be if you are trying to save the report to the client machine – since executeAndDistribute happens on the Gateway, it can only save to locations available to the Gateway’s file system.

Thank you, Kathy. I would, of course, use your executeAndDistribute method, but our users often require that our reports be merged together. In order to avoid exceeding the java heap memory, we merge our reports on our Ignition server.

For this reason, we require special methods to build the reports, merge them, and then send them off to wherever they need to go.

Thank you pturmel. I have not used sendMessage too much, so I will need to look into this a bit more closely; however, it sounds as though this will solve my problem. Thank you!