Last updated
Was this helpful?
Last updated
Was this helpful?
The Batch Processor is a headless client that starts automatically when the server starts and runs without any direct user interaction. It is typically used for backend automation and maintenance tasks. Since this client is initiated as part of the server’s lifecycle, it is ideal for tasks that need to execute consistently on startup or at regular intervals.
The Batch Processor can be configured with specific credentials or startup arguments, depending on your needs, and it can either run a one-time task (like server maintenance) or be scheduled to run recurrently using the .
You can find more detailed information about Batch Processors .
No User Interaction*: The Batch Processor runs automatically with no need for a logged-in user interface.
Login Credentials: You can configure a user credential for authentication, managed through the Servoy Admin Page.
Startup Arguments: Startup arguments can also be set, making it easier to customize the batch session’s behavior during initialization.
Scheduling: You can bind the processor to a startup method for execution upon server start, also schedule recurring tasks via the .
A simple method that runs when the server starts. It can be configured to perform any server-side tasks, like cleaning up logs or running diagnostics In this example, the Batch Processor will clean up old logs and session data in the performMaintenance()
function.
Sometimes, the processor only needs to perform a task once, such as server initialization or cleanup, and then stop.
In this scenario:
The Batch Processor runs the runOneTimeTask()
method.
Once the task completes, the application.exit()
method is called, which shuts down the batch processor.
This is ideal for one-time tasks that don’t need to keep running after startup, such as initializing services or processing data at the server boot.
Key Points:
Scheduler Plugin is used in onSolutionOpen
to add a CRON job that runs every 10 minutes.
The CRON expression '0 0/10 * * * ?'
schedules the task to execute at the start of every 10-minute period.
The recurringTask()
method contains the logic that will be executed every time the job runs.
This setup is useful for tasks like recurring data synchronization, sending automated emails, or running periodic checks.
To run a task at recurring intervals, the can be used. Here’s how to schedule a task that runs every 10 minutes:
Headless Client Plugin Guide / Batch Processor