public interface ITaskQueue
This interface provides a FIFO container for ITask
. Tasks that are
added
to this queue first are fetched
first if they
have the same or higher priority than other tasks in the queue.
A queue is assigned to one and only one (case-sensitive} namespace
by the underlying task queue service. Therefore a queue manages
read-write access for tasks belonging to one specific namespace.
The following example provides a possible usage scenario for a simple single-task system:
An application or service (named A ) may write the following tasks to the queue:
ITaskQueueReader writer = this.service.getTaskQueueWriter( this.user, SERVICE_ID ); // create some tasks ITask entry1 = writer.createTask( properties1, "entry1" ); ITask entry2 = writer.createTask( properties2, "entry2" ); ITask entry3 = writer.createTask( properties3, "entry3" ); ITask entry4 = writer.createTask( properties4, "entry4" ); ITask maxPrio = writer.createTask( properties5, "maxPrio", ITask.MAX_PRIORITY ); ITask minPrio = writer.createTask( properties6, "maxPrio", ITask.MIN_PRIORITY ); // add 4 tasks to the queue (all have the same priority value) writer.add( entry1 ); writer.add( entry2 ); writer.add( entry3 ); writer.add( entry4 );Somewhere else another application (named B ) tries to read some tasks:
ITaskQueueReader reader = this.service.getTaskQueueReader( this.user, SERVICE_ID ); // fetch the tasks ITask task1 = reader.get(); // gets entry1 ITask task2 = reader.get(); // gets entry2 ITask task3 = reader.get(); // gets entry3 ITask task4 = reader.get(); // gets entry4The reading results may differ if another application writes tasks at the same time to the queue.
Some other examples:
A writes tasks in the order minPrio, entry1, maxPrio, entry3,
entry2
. B should read: maxPrio, entry1, entry3, entry2,
minPrio
(in this order).
A writes tasks in the order entry1, entry2, entry3, maxPrio,
minPrio
. B should read: maxPrio, entry1, entry2, entry3,
minPrio
Copyright (c) SAP AG 2003
Modifier and Type | Method and Description |
---|---|
ITask |
add(ITask task)
Adds an entry to the end of the queue.
|
ITask |
get()
Removes and returns a task from the head of the queue.
|
String |
getNamespace()
Returns the service namespace this queue is assigned.
|
boolean |
isEmpty()
Indicates if the queue is empty.
|
ITaskQueueIterator |
iterator()
Creates an iterator for the task queue
entries . |
boolean |
removeTask(ITask task)
Removes a task that is queued by this service.
|
ITask |
top()
Returns a task from the head of the queue.
|
String getNamespace()
ITask add(ITask task) throws WcmException
A queue consists of a list (a sequence) of tasks. The tasks can be added to and removed from the list on a priority basis (lowest priority values first, first-in-first-out (FIFO) basis within priority).
The task's state is set to TaskState.NEW
during this operation. A
TaskStateTransitionException
will be thrown if the task's state
already was set to an illegal state.
task
- The entryWcmException
- Exception raised in failure situationTaskState
ITask get() throws WcmException
TaskState.ACTIVE
during this operation.WcmException
- Exception raised in failure situationITask top() throws WcmException
WcmException
- Exception raised in failure situationboolean removeTask(ITask task) throws WcmException
TaskState.DONE
or TaskState.ERROR
) to avoid non-consistend runtime states.task
- The task to removeWcmException
- Exception raised in failure situationITaskQueueIterator iterator()
entries
.boolean isEmpty() throws WcmException
WcmException
- Exception raised in failure situationAccess Rights |
---|
SC | DC | Public Part | ACH |
---|---|---|---|
[sap.com] KMC-CM
|
[sap.com] tc/km/frwk
|
api
|
EP-KM-CM
|
[sap.com] KMC-WPC
|
[sap.com] tc/kmc/wpc/wpcfacade
|
api
|
EP-PIN-WPC-WCM
|
Copyright 2018 SAP AG Complete Copyright Notice