Event Engine

An administrator can create a PowerShell script to alter or customize data in SafeQ. For example, it can change job info and send a print job to a different endpoint based on circumstances.

At the start of the spooler, the event engine loads all scripts and triggers them once the right event occurs. Script are stored in folder /event-handlers.

The file needs to have the name same as the event it is triggered by. So for example event PrintCommandRecieved triggers only script named PrintCommandRecieved.ps1.


The administrator can access referenced variables and therefore data that can be modified.

$logger - Logger that should be used to log information about the script state. Its output can be found in spooler logs.

$variable - Generic variable that serves as an access point for data passed to the script. All changes to this data object will be translated to the spooler. Its structure is always documented in the template script


An Example of a Script:

    
 $variable.Value.Device.PrintingEndpoint = "ipp://127.0.0.1"    

Template files:

In folder event-handlers, there are files ending with ".template.ps1". It shows examples of simple changes same as the data structure of the variable passed into the script.

For every supported event, there is a template file that briefly describes it and demonstrates how to use its variables. For more information about specific events, you should check its template.

Configuration:

By default event engine is disabled. To enable this feature, you need to add this property to the Spooler configuration file:

EventEngineEnabled = true

These changes need Spooler to be restarted to apply. Logfile contains information about the feature being enabled.