Batch Processors
Last updated
Last updated
A headless client in Servoy is a client session that runs on the server without a user interface. It does not have a visible interface for end users but can perform tasks and execute scripts programmatically. The headless client can be used to run background processes, automate tasks, and perform operations without requiring user interaction. It is typically managed and controlled using the headless API, allowing developers to queue methods, receive callbacks, and monitor the status of tasks running in the headless client session.
A batch processor in Servoy is a term used to describe a headless client session that is configured to start when the entire application server starts. It is designed to run a job on a schedule without the need for user interaction. The batch processor can be set up with specific startup arguments, cron timings, and other parameters to define its behavior. This allows for automated tasks to be executed at regular intervals or on a predefined schedule. The batch processor is stored in the server properties file, ensuring that the solution starts in a headless client every time the server starts up. It is particularly useful for tasks that need to be completely automated without any user intervention, such as running scheduled jobs or recurring processes.
Configured Servoy Batch processors start automatically when the Servoy Application Server is started. The Batch Processor can either execute business logic periodically or can be triggered by an external process.
Here is the webinar section that covers Batch Processors:
In the context of batch processing in Servoy, the onOpen
solution event onSolutionOpen
method can be utilized to trigger actions when the solution containing the batch processor is opened. This onSolutionOpen
method hooked to the onOpen
event is particularly useful for initializing the batch processor, setting up any necessary configurations, and starting the scheduled job that the batch processor will execute.
Here are some common tasks that can be performed in the onSolutionOpen
method for a batch processor:
Configuration Setup: Set up any required configurations for the batch processor, such as defining cron timings, specifying job parameters, or configuring any necessary settings.
Initialization: Initialize variables, set default values, and prepare the batch processor for execution.
Scheduling Jobs: Use the onSolutionOpen
method to schedule the job that the batch processor will run at specified intervals or on a predefined schedule, by combining it with the scheduler plugin.
Logging: Log messages or events related to the batch processor initialization and setup for monitoring and debugging purposes.
By using the onSolutionOpen
method effectively in the context of batch processing, you can ensure that the batch processor is properly configured and ready to execute scheduled tasks as intended.
Example:
The Batch Processor properties' configurations will be recorded in servoy.properties file, so it can also be done purely by configuration. Once a Batch Processor is configured, it's stored in the servoy.properties file, so every time the server comes up the solution will start in a headless client, the onSolutionOpen
method is fired and then in that method is scheduled the task.
Here are the steps to create new batch processor client:
Go to Servoy Admin Page and enter Batch processors section
Pick a solution from that you've imported
Give it some startup arguments, for example cron timings
Give some credentials to login (username and password), if required
Click the Add
button and the Batch process list will appear
Once a batch processor is created, it will appear in the Batch process list.
In order to start a batch processor, find it in the list and click the Start
button of its Status
property.
In order to start a batch processor, find it in the list and click the Stop
button of its Status
property.
In order to start a batch processor, find it in the list and click the Disable
button of its Enablement
property.
By default, batch processors are enabled on server startup. In order to disable all batch processors, click on the Disable
button found on top of the Batch processors section of Servoy Admin Page.
In order to start a batch processor, find it in the list and click the Remove
button of its Solution
property.