Package com.github.workerframework.api
Interface WorkerQueue
- All Known Subinterfaces:
ManagedWorkerQueue
- All Known Implementing Classes:
RabbitWorkerQueue
public interface WorkerQueue
A general representation of a queue for the purposes of a worker service.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
acknowledgeTask
(TaskInformation taskInformation) Called from the asynchronous worker service to notify the queue that it is acknowledging a task.void
discardTask
(TaskInformation taskInformation) Called from the asynchronous worker service to notify the queue that it is discarding a task.Return the name of the input queue.Return the name of the paused queue.void
publish
(TaskInformation taskInformation, byte[] taskMessage, String targetQueue, Map<String, Object> headers) Acknowledge the original received message but send out a new message to a target queue.void
publish
(TaskInformation taskInformation, byte[] taskMessage, String targetQueue, Map<String, Object> headers, boolean isLastMessage) Acknowledge the original received message but send out a new message to a target queue.void
rejectTask
(TaskInformation taskInformation) Called from the asynchronous worker service to notify the queue that it is rejecting a task.
-
Method Details
-
publish
void publish(TaskInformation taskInformation, byte[] taskMessage, String targetQueue, Map<String, Object> headers, boolean isLastMessage) throws QueueExceptionAcknowledge the original received message but send out a new message to a target queue.- Parameters:
taskInformation
- the internal queue message id of the message to acknowledgetaskMessage
- the message to publishtargetQueue
- the queue to put the message uponheaders
- the map of key/value paired headers to be stamped on the messageisLastMessage
- the boolean to indicate if current message is final message for the task- Throws:
QueueException
- if the message cannot be submitted
-
publish
void publish(TaskInformation taskInformation, byte[] taskMessage, String targetQueue, Map<String, Object> headers) throws QueueExceptionAcknowledge the original received message but send out a new message to a target queue.- Parameters:
taskInformation
- the internal queue message id of the message to acknowledgetaskMessage
- the message to publishtargetQueue
- the queue to put the message uponheaders
- the map of key/value paired headers to be stamped on the message- Throws:
QueueException
- if the message cannot be submitted
-
rejectTask
Called from the asynchronous worker service to notify the queue that it is rejecting a task. It is up to the queue implementation as to whether submit this task to retry or not.- Parameters:
taskInformation
- the queue task id that has been rejected
-
discardTask
Called from the asynchronous worker service to notify the queue that it is discarding a task.- Parameters:
taskInformation
- the queue task id that has been discarded
-
acknowledgeTask
Called from the asynchronous worker service to notify the queue that it is acknowledging a task.- Parameters:
taskInformation
- the queue task id that has been acknowledged
-
getInputQueue
String getInputQueue()Return the name of the input queue.- Returns:
- the name of the input queue
-
getPausedQueue
String getPausedQueue()Return the name of the paused queue.- Returns:
- the name of the paused queue
-