Create single task programtically

I need to create a job / task that will run only once. when I create a user I have a heavy operation to perform and I want that to be async and monitored by CUBA.
Is it possible to create a single task programmatically that will be executed only once? and I will create a new task every customer creation.


Hi Avi,

There is no such feature out-of-the-box.

So I should create one schdual task and query for all the customers who hasnt participage in the task yet?

I wouldn’t recommend using the scheduled tasks mechanism for this.

  • Create your own entity, say Task with executed attribute.
  • Create a middleware bean that loads all non-executed tasks and runs them.
  • Create a scheduled task that periodically invokes the bean.
  • Optionally, you can create a UI screen for monitoring the Task entities.