Getting started Community Training Tutorials Documentation APIs, AI & Tools
public class ExampleSourceScheduler extends Source<Serializable, VMMessageAttributes> {
@Inject
private SchedulerService schedulerService;
@Inject
private SchedulerConfig schedulerConfig;
private ComponentLocation location;
private Scheduler scheduler;
@Override
public void onStart(SourceCallback<Serializable, VMMessageAttributes> sourceCallback) throws MuleException {
scheduler = schedulerService.customScheduler(schedulerConfig
.withMaxConcurrentTasks(numberOfConsumers)
.withName("vm-listener-flow " + location.getRootContainerName())
.withWaitAllowed(true)
.withShutdownTimeout(5, SECONDS));
}
@Override
public void onStop() {
if (scheduler != null) {
scheduler.stop();
}
}
}



