diff --git a/libs/micronaut-worker/src/main/java/com/agorapulse/worker/convention/QueueConsumer.java b/libs/micronaut-worker/src/main/java/com/agorapulse/worker/convention/QueueConsumer.java index 0132e7de..0fbc31ac 100644 --- a/libs/micronaut-worker/src/main/java/com/agorapulse/worker/convention/QueueConsumer.java +++ b/libs/micronaut-worker/src/main/java/com/agorapulse/worker/convention/QueueConsumer.java @@ -41,6 +41,17 @@ @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) public @interface QueueConsumer { + /** + * Allows to override the default name of the job which is JobClassName if there is only one executable + * method (e.g. job definition) in the class or JobClassName-methodName if there is more then one executable method in the class. + *

+ * Either the job name specified here or the default name is converted using {@link io.micronaut.core.naming.NameUtils#hyphenate(String)}. + * + * @return the name of the job used for configuration + */ + @AliasFor(annotation = Named.class, member = "value") + String name() default ""; + /** * @return the name of the work queue to consume items from */ @@ -57,7 +68,7 @@ * The time to wait for the next message to be available and also the time to wait for the next run. * @return the maximum waiting time as duration string */ - @AliasFor(annotation = Consumes.class, member = "value") + @AliasFor(annotation = Consumes.class, member = "waitingTime") @AliasFor(annotation = FixedRate.class, member = "value") String waitingTime() default ""; @@ -70,7 +81,10 @@ int maxMessages() default JobConfiguration.ConsumerQueueConfiguration.DEFAULT_MAX_MESSAGES; /** - * @return The name of a {@link Named} bean that is a + * The name of the task executor to use to execute the job. If default value is usd then new scheduled executor + * is created for each job with the number of threads equal to the fork value. + * + * @return The name of a {@link jakarta.inject.Named} bean that is a * {@link java.util.concurrent.ScheduledExecutorService} to use to schedule the task */ @AliasFor(annotation = Job.class, member = "scheduler") diff --git a/libs/micronaut-worker/src/main/java/com/agorapulse/worker/convention/QueueProducer.java b/libs/micronaut-worker/src/main/java/com/agorapulse/worker/convention/QueueProducer.java index b4aaa7b5..412fa569 100644 --- a/libs/micronaut-worker/src/main/java/com/agorapulse/worker/convention/QueueProducer.java +++ b/libs/micronaut-worker/src/main/java/com/agorapulse/worker/convention/QueueProducer.java @@ -21,6 +21,7 @@ import com.agorapulse.worker.annotation.Job; import com.agorapulse.worker.annotation.Produces; import io.micronaut.context.annotation.AliasFor; +import jakarta.inject.Named; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; @@ -50,6 +51,12 @@ * * @return the name of the job used for configuration */ + @AliasFor(annotation = Named.class, member = "value") + String name() default ""; + + /** + * @return the name of the work queue to produce items to + */ @AliasFor(annotation = Produces.class, member = "value") String value() default "";