Integrate by Event Socket Consumer
Event Socket Consumer integration extends the functionality of other applications so users can print labels generated with data provided by those applications through a direct socket connection. The connection is one-way and there is no response from Spectrum over the socket — the client connects, sends data, and then closes the connection.
Print Labels Generated by XML (LPS) Data
You can use an Event Socket Consumer integration to accept XML (LPS) data through a socket connection and initiate a print job. To create an Event Socket Consumer integration that accepts XML (LPS) data for job requests, do the following.
- In Integrations
> Event Socket Consumer to create an Event Socket Consumer integration.
- In the Basic Configuration panel, configure the following details.
- For Hostname, enter the host name or IP address of the Spectrum Application Server. If your instance of Spectrum has multiple network interface cards (NICs), you must specify this field. If left blank, the host name is determined automatically.
- For Port, enter the listener port number for the socket. The default port is 2813.
- For Run As, select the Spectrum user account under which print requests associated with this integration should be run. This user account must have at least the INTEGRATOR role or equivalent permissions.
- For Error Log Level, select the type of message to include in log files.
- In the Processors panel, configure the following details to allow Spectrum to process the XML (LPS) data.
- Under Available Processors, select Job Request Converter and then click Add Before.
- With Job Request Converter selected under Configured Processors, click the Main Script panel. This processor will convert the input to a Job Request.
- For Input Type, select the type of input. If you select Not Set, the input must already be a Job Request, or you can enter a script with custom logic to convert your input to a Job Request.
- Under Available Processors, select Job Service and then click Add After to allow the integration to initiate print jobs.
- Under Available Processors, specify a unique job target folder for the integration.
- With Job Service selected under Configured Processors, click the Main Script panel.
- Enter the following script:
/* Set the Job Target Folder. Set the value to the full path in Spectrum for the job target folder to be used. */
getMessageBody().setFolderUrl("/Default/Job_Target_folder");
/* The following must be included to send the job request when using a script. */
processRequest();
- If you want to specify a process for the integration, configure the following additional details for Available Processors.
Note: This step is optional. If not specified, the integration uses the Generic Document Process.
- With Job Service selected under Configured Processors, click the Main Script panel.
- Enter the following script before the processRequest(); line.
/* Set the Job Process. Set the value to the full path in Spectrum for the process to be used. */
var processUrl = "/Default/Process";
var processes = getMessageBody().getProcesses();
var iter = processes.iterator();
while (iter.hasNext()) {
var process = iter.next();
process.setProcessUrl(processUrl);
log("\n***process: " + process);
}
ExampleThe following script specifies a job target folder named MyFolder with the path in Spectrum Loftware Inc/MyFolder, and a process named MyProcess with the path Loftware Inc/MyProcess.
getMessageBody().setFolderUrl("/Loftware Inc/MyFolder");
var processUrl = "/Loftware Inc/MyProcess";
var processes = getMessageBody().getProcesses();
var iter = processes.iterator();
while (iter.hasNext()) {
var process = iter.next();
process.setProcessUrl(processUrl);
log("\n***process: " + process);
}
processRequest();
- In the Properties pane, enter a description of the purpose of the integration.
- Click File > Save or click Save
in the toolbar.
- In the Save dialog box, enter a name for the integration.
Characters permitted in names
The following characters are permitted in the name: letters, numbers, parentheses, square brackets, ampersands, plus signs, commas, semi-colons, and tildes. Additionally, the following characters are permitted but cannot begin or end the name: spaces, double quotation marks, single quotation marks, hyphens, underscores, periods, and grave accents. For letters, the case that you specify is displayed, but case is ignored when Spectrum interprets a name. If you will be installing the Spectrum application on a computer running Windows Server, and transferring data between Spectrum instances, see the "Transferring Spectrum Data in a Compressed File" section of the Loftware Spectrum Data Transfer Guide.
- In the left pane of the Save dialog box, select the folder in which to save the integration. You can click a folder to display subfolders.
- Click OK to save the integration. Creation information is displayed in the Properties pane.
- In the Save dialog box, enter a name for the integration.
- In the ribbon, click Home > Start Integration.
- To verify that the integration has started, view the Status in the Properties pane.
Important! Whenever you add a new device, data service, integration, or facility, you must ensure that the service is activated on all Spectrum Application Servers on which it should be available to run and started on at least one. In an environment with only one Spectrum Application Server, these types of services are automatically activated and started when they are created. For more information,