Overview

A quick overview of the core components and ideas behind Doddle

Storage

Storage is a place where Doddles keeps all the information related to the jobs and queues. The storage provider is agnostic in Doddle - it doesn't care where the data is being stored just as long as there is an implementation for it (see implementing a storage provider for doddle)

Client

All external interactions with Doddle go through the client - it provides a facade to the underlying system.

client.enqueue(wizard -> {
    wizard.queue("high")
          .task("sayHello");
    return wizard;
});

Please look at the documentation for the client here.

Tasks

A task is the work (method) that will be executed by a job. Defining a task is as simple as annotating a method with the @Task method.

@Task
public void process(JobExecutionContext context) {
    context.logger().info("Processing job: {}", content.job().id());
}

Please look at the introduction to tasks documentation for all the functionalities.

Scheduler

The scheduler periodically checks for enqueued jobs that are ready to be processed. If a job is ready to be processed then it is marked as available ready to be picked up by the next worker thread.

It also checks if a CRON (recurring job) needs to be executed and enqueues it ready to be picked up.

The scheduler also has some other responsibilities such as checking for stuck jobs and delete old jobs within a given timeframe.

Poller

The poller is a pool of worker threads that poll for jobs that are marked as available and processes them. In case of failure, the poller will mark the job as a failure and reschedule for execution at a later date (based on the given retry strategy). In case of success, the job will be marked as completed.

Last updated