public class QueueManager extends Object implements IProcessQueueManagerSPI
IProcessQueueManager
to execute producing related activities and IProcessQueueManagerSPI
to execute consuming related activities.Constructor and Description |
---|
QueueManager()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
existsTaskWithLockNotRunning(String lockId)
Check if exists a task with given lock identifier that is not running.
|
IQueueTaskProcess |
getNextQueueTaskProcessForExecution()
Returns the next task process for execution.
|
IQueueStatistics |
getQueueStatistics()
Retrieves the current situation statistics of the queue.
|
IQueueTaskProcess |
getTaskProcess(String processId)
Retrieves the queue item of represented by the processId.
|
Collection<IQueueTaskProcess> |
getTaskProcessByOwnerId(String ownerId)
Returns the processes of a given owner.
|
void |
removeFromQueue(IQueueTaskProcess item,
boolean notifyListeners)
Removes from queue the current item.
|
void |
reprocess(String processId)
Triggers the process to be retried.
|
IQueueTaskProcess |
schedule(IQueueTask task,
QueueTaskScheduleConfig taskScheduleConfig)
Schedules the execution of the given task.
|
void |
setFailedStatus(IQueueTaskProcess queueItem)
Sets the given process the status of
QueueTaskProcessStatus.Failed . |
public IQueueTaskProcess schedule(IQueueTask task, QueueTaskScheduleConfig taskScheduleConfig) throws PortalException
IProcessQueueManager
This operation uses the current transactional context. The task will only be available for execution after the transaction is commited. If the transaction is rolled back the scheduling will also be aborted.
schedule
in interface IProcessQueueManager
task
- the task to be executed.taskScheduleConfig
- contains the configuration for the execution
schedule.PortalException
- if the task could not be scheduled.public IQueueTaskProcess getTaskProcess(String processId) throws PortalException
IProcessQueueManager
getTaskProcess
in interface IProcessQueueManager
PortalException
public IQueueTaskProcess getNextQueueTaskProcessForExecution() throws PortalException, InterruptedException
IProcessQueueManagerSPI
The returned task will already have its status changed
to QueueTaskProcessStatus.Running
.
getNextQueueTaskProcessForExecution
in interface IProcessQueueManagerSPI
PortalException
- if there is an error obtaining the process.InterruptedException
- if the current thread is interrupted.public void removeFromQueue(IQueueTaskProcess item, boolean notifyListeners) throws PortalException
IProcessQueueManagerSPI
removeFromQueue
in interface IProcessQueueManagerSPI
item
- to be removed from queue.notifyListeners
- if the threads should be waken up.PortalException
public void setFailedStatus(IQueueTaskProcess queueItem) throws PortalException
IProcessQueueManagerSPI
QueueTaskProcessStatus.Failed
.setFailedStatus
in interface IProcessQueueManagerSPI
queueItem
- item to be put in failed status.PortalException
public IQueueStatistics getQueueStatistics() throws PortalException
IProcessQueueManager
getQueueStatistics
in interface IProcessQueueManager
PortalException
public void reprocess(String processId) throws PortalException
IProcessQueueManager
reprocess
in interface IProcessQueueManager
processId
- id of the process to be reprocessed.PortalException
public Collection<IQueueTaskProcess> getTaskProcessByOwnerId(String ownerId) throws PortalException
IProcessQueueManager
getTaskProcessByOwnerId
in interface IProcessQueueManager
ownerId
- the owner identifier.PortalException
public boolean existsTaskWithLockNotRunning(String lockId)
IProcessQueueManagerSPI
existsTaskWithLockNotRunning
in interface IProcessQueueManagerSPI
lockId
- the lock identifier.LumisXP 12.4.0.200625 - Copyright © 2006–2020 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.