Task Registration
To register tasks in the system, define them in your worker configuration file located at:
src/config/application.yaml
Basic Example
kafkaTopics:
- topic: backend.exampleWorker.tasks
consumerGroup: example-pluggable-worker
worker:
name: example-pluggable-worker
owner: example-pluggable-worker-owner
tasks:
- name: EXAMPLE_TASK # Task name
description: EXAMPLE_TASK_DESCRIPTION # Task description
publish: true # Whether the task should be exposed via the public gateway.
tags:
- platform-task # Refer to the naming conventions guideline for information on tags
Enable Preflight
tasks:
- name: EXAMPLE_TASK # Task name
enablePreflight: true # If true, calls to resolve task-options before actual task submission.
Monetization Configs
tasks:
- name: EXAMPLE_TASK
monetization:
toolId: myToolId # ID used for credit tracking; contact the Monetization team to obtain one
History Configs
tasks:
- name: EXAMPLE_TASK
history:
persist: true # Whether to persist task history
ttlInHours: 720 # Optional; time-to-live in hours. If not set, data will not expire
Notification Configs
tasks:
- name: EXAMPLE_TASK
notification:
enabled: true # Whether notifications are enabled for the task
platforms: [ "WEBSITE" ] # Optional; list of platforms to enable notifications from, defaults to all (`APPLE`, `ANDROID`, `WEBSITE`)
data:
title: "Generation Successful" # Optional; notification title for successful task
description: "Your results are ready to view." # Notification description for successful task
cta_label: "View" # Optional; notification CTA button title for successful task
error_title: "Generation Unsuccessful" # Optional; notification title for failed task
error_description: "An error occurred during generation. Please try again later." # Optional; notification description for failed task
error_cta_label: "Try again" # Optional; notification CTA button title for failed task
ForceUpdate Config
tasks:
- name: EXAMPLE_TASK
forceUpdate: true
Each task must have a unique name across all workers.
The forceUpdate property is optional. When set to true, it allows a task with the same name to be reassigned to a different worker.
If the task already exists on another worker, that instance will be removed automatically, and the task will be re-registered under the current worker.
info
Use this to migrate a task from one worker to another without needing manual deregistration.
warning
use forceUpdate with caution, as it overrides existing task registrations and may interrupt ongoing work.
Unregister Tasks
To unregister a task from the system, you may remove it from the tasks array. Leaving the array empty will delete all tasks.