I have a WAR that is deployed that currently executes tasks based on Springs Task Execution and Scheduling service. It is pretty basic yet works very well. He is an example of my config:
What I would like to do is provide an endpoint that a user can hit to schedule the task to run now. I want to use the scheduler that I defined above as I only want one task to run at a time. IE when the user hits the endpoint I will schedule (not run) the task, the scheduler will then run the task when ready. Is there any way from a REST endpoint that I define using spring that I can get a hold of the scheduler (maybe inject it), create the "beanA" class and schedule the "methodA".
<task:scheduled ref="beanA" method="methodA" cron="cron="*/5 * * * * MON-FRI""/>
<!-- only want one task to execute at a time -->
<task:scheduler id="myScheduler" pool-size="1"/>
Thanks in advance for any help/ideas!