com.geneea.celery.TaskRegistry Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of celery-java Show documentation
Show all versions of celery-java Show documentation
Java library for interfacing with http://celeryproject.org including code for both task submissions and task
execution.
package com.geneea.celery;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Streams;
import java.util.Map;
import java.util.ServiceLoader;
import java.util.Set;
import java.util.function.Function;
/**
* Loads registered {@link CeleryTask} services and provides them by their class name.
*/
class TaskRegistry {
private static final Map TASKS = Streams
.stream(ServiceLoader.load(CeleryTaskLoader.class))
.map((loader) -> loader.loadTask())
.collect(ImmutableMap.toImmutableMap((v) -> v.getClass().getName(), Function.identity()));
static Set getRegisteredTaskNames() {
return TASKS.keySet();
}
static Object getTask(String taskName) {
return TASKS.get(taskName);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy