Announcement Announcement Module
Collapse
No announcement yet.
Submit task for Scheduler from a REST endpoint Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Submit task for Scheduler from a REST endpoint

    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:

    Code:
    <task:scheduled-tasks scheduler="myScheduler">
        <task:scheduled ref="beanA" method="methodA" cron="cron="*/5 * * * * MON-FRI""/>
    </task:scheduled-tasks>
    
    <!-- only want one task to execute at a time -->
    <task:scheduler id="myScheduler" pool-size="1"/>
    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".

    Thanks in advance for any help/ideas!
Working...
X