Module Implementation

A module is started by the datasqill server as a standalone subprocess. After startup, it must read its input parameters and, after completing its task, return its return values to the server.

The following convention applies as the interface between the datasqill server and a module process:

  • The server sends the input parameters to the module process via the standard input channel (stdin).
  • The module sends its results back to the server via the standard error channel (stderr).
  • The module can send debug output via the standard output channel (stdout), which the server can persist with the help of a table and make available to the datasqill developer.
  • The input parameters are sent as a JSON string that must conform to a fixed format.
  • The return values are also sent back as a JSON string, for which a corresponding format is defined.

Java modules are implemented as Java classes that implement an interface. This interface is called datasqillProgram and has an abstract method:

public datasqillTransformationAnswer execute(datasqillTransformationRequest request) throws Exception

Furthermore, the module class must implement a main method so that the server can start it. This typically looks like this:

public static void main(String args[]) {
    datasqillProgramStart.init(args, new DsModDemo());
}

The classes datasqillProgramStart, datasqillTransformationRequest, and datasqillTransformationAnswer can be found in the datasqill library (see also the corresponding section).

In the example, the main method from the class DsModDemo is shown; for custom classes, the constructor call after "new" should of course be adapted accordingly.