com.sapportals.wcm.service.taskqueue

Interface ITaskQueueService

All Superinterfaces:
IService

public interface ITaskQueueService
extends IService

The task queue is a base service for clustered systems.

It provides interfaces to write and to read tasks in a platform-spreading queue and to monitor the tasks and (above all) their processing state.

Access to the task queue is provided by a ITaskQueueReader and a ITaskQueueWriter interface. This thin interfaces support the implementation of highly spezialised and customizable distributed services. (For example a service could implement a customized service writer as a wrapper of the task queue writer and a customized service daemon reader as a wrapper of the reader).

Reader and writer are assigned to a special namespace and a service user. A writer can only write tasks belonging to its namespace. A reader can only read task of its namespace. A namespace is a unique application identifier.

A task 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).

This services provides support of different persistence layers. It is recommended to use the database persistence layer in production systems. File system and memory persistence layers are only recommended for testing to offer a high-performance test plattform with some restrictions.

The monitor methods will return only a snapshot of the current task queue. For maintenance a remove method is provided to remove completly progressed or incorrectly aborted tasks from the queue.


Field Summary
static String TASKQUEUE_SERVICE
          identifier for TaskQueue Service
 
Method Summary
 ITaskQueueReader getTaskQueueReader(String user, String namespace)
          Returns a task queue reader for read acccess to the queue service.
 ITaskQueueWriter getTaskQueueWriter(String user, String namespace)
          Returns a task queue writer for write acccess to the queue service.
 ITask monitorTask(String id)
          Returns a task with id id
 ITaskQueueIterator monitorTaskQueue(String namespace)
          Returns an iterator for tasks belonging to service .
 ITaskQueueIterator monitorTaskQueue(TaskState state)
          Returns an iterator for tasks that have task state state .
 ITaskQueueIterator monitorTaskQueues()
          Returns an iterator for all queued tasks.
 boolean removeTask(ITask task)
          Removes a task that is queued by this service.
 
Methods inherited from interface com.sapportals.wcm.service.IService
getDescription, getDescription, getID
 

Field Detail

TASKQUEUE_SERVICE

static final String TASKQUEUE_SERVICE
identifier for TaskQueue Service

See Also:
Constant Field Values
Method Detail

getTaskQueueWriter

ITaskQueueWriter getTaskQueueWriter(String user,
                                    String namespace)
                                    throws WcmException
Returns a task queue writer for write acccess to the queue service.

Parameters:
user - The user of this interface
namespace - The namespace this writer is assigned to.
Returns:
A new task queue writer.
Throws:
WcmException - Exception raised in failure situation

getTaskQueueReader

ITaskQueueReader getTaskQueueReader(String user,
                                    String namespace)
                                    throws WcmException
Returns a task queue reader for read acccess to the queue service.

Parameters:
user - The user of this interface
namespace - The namespace this reader is assigned to.
Returns:
A new task queue reader.
Throws:
WcmException - Exception raised in failure situation

monitorTaskQueue

ITaskQueueIterator monitorTaskQueue(String namespace)
                                    throws WcmException
Returns an iterator for tasks belonging to service . This is a snapshot of the current task queue. It does not change during time.

Parameters:
namespace - The namespace to monitor
Returns:
An iterator that includes the snapshot.
Throws:
WcmException - Exception raised in failure situation

monitorTaskQueue

ITaskQueueIterator monitorTaskQueue(TaskState state)
                                    throws WcmException
Returns an iterator for tasks that have task state state . This is a snapshot of the current task queue. It does not change during time.

Parameters:
state - The state to monitor
Returns:
An iterator that includes the snapshot.
Throws:
WcmException - Exception raised in failure situation

monitorTask

ITask monitorTask(String id)
                  throws WcmException
Returns a task with id id

Throws:
WcmException

monitorTaskQueues

ITaskQueueIterator monitorTaskQueues()
                                     throws WcmException
Returns an iterator for all queued tasks. This is a snapshot of the current task queue. It does not change during time.

Returns:
The total queued tasks.
Throws:
WcmException - Exception raised in failure situation

removeTask

boolean removeTask(ITask task)
                   throws WcmException
Removes a task that is queued by this service. The task to remove must have been processed (task state was set to TaskState.DONE or TaskState.ERROR).

Parameters:
task - The task to remove
Returns:
indicates if the task was removed (if it was contained in the queue service)
Throws:
WcmException - Raised on illegal task states, persistence failures,...
Access Rights

This class can be accessed from:


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 2014 SAP AG Complete Copyright Notice