Queues
Doddle can process multiple queues and each one can have a different priority.
Implementation details
The priority for a queue is a value between 0 and 1. The lower the number, the higher the priority.
Queue names must only consist of lowercase letters, digits, underscore, and dash (since 1.7.6) characters only.
A queue can also be locked and unlocked. Workers will be not pick up jobs associated to a queue that has been locked.
Defining queues
Queues can be defined by using the client:
client.queues().create(options -> {
return options.name("high")
.priority(0f);
});
Operations
Fetch queues
List<Queue> all = client.queues().all();
Fetch a queue by its identifier
String id = "56c8576b-ca5d-49ec-b0d8-029074a0f18a";
Optional<Queue> queue = client.queues().id(id);
Fetch a queue by its name
Optional<Queue> queue = client.queues().name("high");
Delete a queue
This will throw an error if there are jobs associated to the queue
String id = "56c8576b-ca5d-49ec-b0d8-029074a0f18a";
client.queues().delete(id);
Delete all queues
If a queue has jobs associated to it then it will not be deleted
client.queues().deleteAll();
Lock and unlock queues
client.queues().lockAll();
client.queues().unlockAll();
client.queues().lock("56c8576b-ca5d-49ec-b0d8-029074a0f18a");
client.queues().unlock("56c8576b-ca5d-49ec-b0d8-029074a0f18a");
Last updated
Was this helpful?