public interface Worker extends JobExecutor, Runnable, WorkerEventEmitter
final Worker worker = new WorkerImpl(config, Worker.ALL_QUEUES,
Arrays.asList("TestAction"));
final Thread t = new Thread(worker);
t.start();
Thread.yield();
...
worker.end();
t.join();
JobExecutor.State| Modifier and Type | Field and Description |
|---|---|
static Collection<String> |
ALL_QUEUES
Special value to tell a Worker to poll all currently available queues.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addQueue(String queueName)
Poll the given queue.
|
String |
getName()
Returns the name of this Worker.
|
Collection<String> |
getQueues()
The queues that this Worker will poll.
|
boolean |
isPaused()
Returns whether this worker is paused.
|
void |
removeAllQueues()
Stop polling all queues.
|
void |
removeQueue(String queueName,
boolean all)
Stop polling the given queue.
|
void |
setQueues(Collection<String> queues)
Clear any current queues and poll the given queues.
|
void |
togglePause(boolean paused)
Toggle whether this worker will process any new jobs.
|
addJobType, end, getExceptionHandler, getJobTypes, isProcessingJob, isShutdown, join, removeJobName, removeJobType, setExceptionHandler, setJobTypesaddListener, addListener, removeAllListeners, removeAllListeners, removeListener, removeListenerstatic final Collection<String> ALL_QUEUES
String getName()
boolean isPaused()
void togglePause(boolean paused)
paused - if true, the worker will not process any new jobs;
if false, the worker will process new jobsCollection<String> getQueues()
void addQueue(String queueName)
queueName - the name of the queue to pollvoid removeQueue(String queueName, boolean all)
all argument is
true, all instances of the queue will be removed, otherwise, only
one instance is removed.queueName - the queue to stop pollingall - whether to remove all or only one of the instancesvoid removeAllQueues()
void setQueues(Collection<String> queues)
queues - the queues to pollCopyright © 2011-2013. All Rights Reserved.