I have a case which I want to ask can I solve with Spring Shell. I have a main.jar application which have several Scheduled Spring Jobs deployed on Wildly server. In my case I can't stop or redeploy the main.jar because the service must be provided non-stop.
I need a way to start/stop/restart the Scheduled Spring Jobs from the terminal. For example in Apache Karaf there is a shell which I can use via telnet.
Is there some similar solution in Spring Shell so that can let me execute commands from the linux terminal.
For simple scheduled tasks, there's no CLI control out of the box in spring/spring-boot.
You will need to implement it yourself.
Below is a simple example of how you can control your scheduled tasks and expose the start/stop methods to the command line using spring shell.
Let's consider you have a common interface for all scheduled tasks:
So a simple scheduled task will look like:
and the corresponding CLI component will look like:
@ShellComponent
and@ShellMethod
are exposing the methods to the Spring Shell process.