diff --git a/common/src/main/java/stirling/software/common/annotations/AutoJobPostMapping.java b/common/src/main/java/stirling/software/common/annotations/AutoJobPostMapping.java index 755f143aa..062f3e0a1 100644 --- a/common/src/main/java/stirling/software/common/annotations/AutoJobPostMapping.java +++ b/common/src/main/java/stirling/software/common/annotations/AutoJobPostMapping.java @@ -6,42 +6,73 @@ import org.springframework.core.annotation.AliasFor; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +/** + * Shortcut for a POST endpoint that is executed through the Stirling "auto‑job" framework. + *

+ * Behaviour notes: + *

+ *

+ * + *

Unless stated otherwise an attribute only affects async execution.

+ */ @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) @Documented @RequestMapping(method = RequestMethod.POST) public @interface AutoJobPostMapping { + + /** + * Alias for {@link RequestMapping#value} – the path mapping of the endpoint. + */ @AliasFor(annotation = RequestMapping.class, attribute = "value") String[] value() default {}; + /** + * MIME types this endpoint accepts. Defaults to {@code multipart/form-data}. + */ @AliasFor(annotation = RequestMapping.class, attribute = "consumes") String[] consumes() default {"multipart/form-data"}; /** - * Custom timeout in milliseconds for this specific job. If not specified, the default system - * timeout will be used. + * Maximum execution time in milliseconds before the job is aborted. + * A negative value means "use the application default". + *

Only honoured when {@code async=true}.

*/ long timeout() default -1; - /** Maximum number of times to retry the job on failure. Default is 1 (no retries). */ + /** + * Total number of attempts (initial + retries). Must be at least 1. + * Retries are executed with exponential back‑off. + *

Only honoured when {@code async=true}.

+ */ int retryCount() default 1; /** - * Whether to track and report progress for this job. If enabled, the job will send progress - * updates through WebSocket. + * Record percentage / note updates so they can be retrieved via the REST status endpoint. + *

Only honoured when {@code async=true}.

*/ boolean trackProgress() default true; /** - * Whether this job can be queued when system resources are limited. If enabled, jobs will be - * queued instead of rejected when the system is under high load. The queue size is dynamically - * adjusted based on available memory and CPU resources. + * If {@code true} the job may be placed in a queue instead of being rejected when resources + * are scarce. + *

Only honoured when {@code async=true}.

*/ boolean queueable() default false; /** - * Optional resource weight of this job (1-100). Higher values indicate more resource-intensive - * jobs that may need stricter queuing. Default is 50 (medium weight). + * Relative resource weight (1–100) used by the scheduler to prioritise / throttle jobs. Values + * below 1 are clamped to 1, values above 100 to 100. */ int resourceWeight() default 50; }