Can I use different executor for each @Async method call?

145 views Asked by At

In a spring component, i have this method:

@Async("@taskExecutorFactory.getOrCreate(#taskId)")
public void updateTask(String taskId) {
    // update code
}

I would like to use a different executor for each call. The executor is provide by the TaskExecutorFactory bean according to the taskId. The expression @taskExecutorFactory.getOrCreate(#taskId) is not recognized by spring at startup with the error:

A component required a bean named '@taskExecutorFactory.getOrCreate(#chainTaskId)'
that could not be found.

Any ideas if this is possible?

0

There are 0 answers