Ticket Management with Cron Jobs
Use Cron jobs to automate managing tickets. For example, have a job to run at a regular schedule to delete any tickets that have a resolution type of duplicate or done.
Follow the steps to enable and deploy the cron job:
-
Navigate back to the ticketing system site page. Click Generate a New Ticket a few times until you have at least one ticket that has either a
duplicateordoneresolution type.
-
Open a command line and run the following command:
./gradlew :client-extensions:liferay-ticket-etc-cron:deployCheck your logs to verify successful deployment.
-
Next, run the following command to start the spring boot application:
./gradlew :client-extensions:liferay-ticket-etc-cron:bootRunThe cron job is now running. Check the logs or refresh the ticketing system site page to verify that a ticket has been deleted.

Examine the Cron Job Code
This cron job is a microservice type client extension. Specifically, it is a Spring Boot application just like the previous documentation referral system client extension. Therefore, the client-extension.yaml file contains the same assemble block section as well as the oAuthApplicationUserAgent section like before.
The relevant Spring Boot files for the application are contained in the /src folder. A full explanation of the Java code is beyond the scope of this tutorial, but there are a few things to note:
-
The
TicketSpringBootApplication.javafile does the OAuth authorization. -
The main logic is found in the
TicketCommandLineRunner.javafile. If the ticket’s resolution equalsduplicateordone, the ticket is deleted.
Congratulations on completing this solutions tutorial on building a custom ticketing system.