public class MessageProcessingJob extends ConcurrentJob<MessageDelivery> implements org.quartz.StatefulJob
Modifier and Type | Class and Description |
---|---|
static class |
MessageProcessingJob.Mode |
Modifier and Type | Field and Description |
---|---|
static String |
GROUP |
static String |
NAME |
executor, txManager
Constructor and Description |
---|
MessageProcessingJob() |
MessageProcessingJob(Long messageId,
MessageProcessingJob.Mode mode,
String user,
String cause) |
Modifier and Type | Method and Description |
---|---|
protected Collection<MessageDelivery> |
bulkProcess(BulkMessageDeliverer messageDeliverer,
Collection<MessageDelivery> messageDeliveries,
MessageProcessingJob.Mode mode)
Implements bulk delivery of a collection of
MessageDelivery s |
void |
execute(org.quartz.JobExecutionContext context) |
protected void |
finishProcessing(ProcessingResult<MessageDelivery> result)
Template method called after processing of work items has completed
|
protected Collection<Collection<MessageDelivery>> |
groupWorkItems(Collection<MessageDelivery> workItems,
ProcessingResult<MessageDelivery> result)
Group work items by deliverer and notification, so that deliveries to bulk deliverers are grouped
by notification
|
protected Collection<MessageDelivery> |
process(MessageDeliverer messageDeliverer,
MessageDelivery messageDelivery,
MessageProcessingJob.Mode mode)
Implements delivery of a single MessageDelivery
|
protected Collection<MessageDelivery> |
processWorkItems(Collection<MessageDelivery> messageDeliveries)
Template method that subclasses should override to process a given work item and mark it
as untaken afterwards
|
ProcessingResult<MessageDelivery> |
run()
Main processing method which invokes subclass implementations of template methods
to obtain available work items, and process them concurrently
|
void |
setGenericDao(GenericDao dao)
Sets the
GenericDao |
void |
setMessageDelivererRegistry(MessageDelivererRegistryService registry)
Sets the
MessageDelivererRegistryService |
void |
setMessageDeliveryService(MessageDeliveryService messageDeliveryService)
Sets the
MessageDeliveryService |
protected Collection<MessageDelivery> |
takeAvailableWorkItems()
Template method that subclasses should override to obtain a set of available work items
and mark them as taken
|
protected void |
unlockWorkItem(MessageDelivery item)
Template method that subclasses should override to unlock a given work item when procesing has failed.
|
protected void |
updateStatusAndUnlock(MessageDelivery messageDelivery,
MessageDeliveryStatus status)
Marks a MessageDelivery as having been delivered, and unlocks it
|
createNewTransaction, executeInTransaction, setExecutorService, setTransactionManager, unlockWorkItemAtomically
public static final String NAME
public static final String GROUP
public MessageProcessingJob(Long messageId, MessageProcessingJob.Mode mode, String user, String cause)
public MessageProcessingJob()
public void setGenericDao(GenericDao dao)
GenericDao
dao
- the GenericDao
public void setMessageDelivererRegistry(MessageDelivererRegistryService registry)
MessageDelivererRegistryService
registry
- the MessageDelivererRegistryService
public void setMessageDeliveryService(MessageDeliveryService messageDeliveryService)
MessageDeliveryService
messageDeliveryService
- the MessageDeliveryService
protected Collection<MessageDelivery> takeAvailableWorkItems()
ConcurrentJob
takeAvailableWorkItems
in class ConcurrentJob<MessageDelivery>
protected void unlockWorkItem(MessageDelivery item)
ConcurrentJob
unlockWorkItem
in class ConcurrentJob<MessageDelivery>
item
- the work item to unlockprotected Collection<Collection<MessageDelivery>> groupWorkItems(Collection<MessageDelivery> workItems, ProcessingResult<MessageDelivery> result)
groupWorkItems
in class ConcurrentJob<MessageDelivery>
workItems
- list of work items to break into groupsresult
- ProcessingResult to modify if there are any failures...this is sort of a hack because previously
failure to obtain a deliverer was considered a work item failure, and now this method has been factored out...
but the tests still want to see the failureorg.kuali.rice.ken.service.impl.ConcurrentJob#groupWorkItems(java.util.Collection)
protected Collection<MessageDelivery> processWorkItems(Collection<MessageDelivery> messageDeliveries)
ConcurrentJob
processWorkItems
in class ConcurrentJob<MessageDelivery>
protected Collection<MessageDelivery> process(MessageDeliverer messageDeliverer, MessageDelivery messageDelivery, MessageProcessingJob.Mode mode)
deliverer
- the deliverermessageDelivery
- the deliveryprotected Collection<MessageDelivery> bulkProcess(BulkMessageDeliverer messageDeliverer, Collection<MessageDelivery> messageDeliveries, MessageProcessingJob.Mode mode)
MessageDelivery
sdeliverer
- the deliverermessageDeliveries
- the deliveriesprotected void finishProcessing(ProcessingResult<MessageDelivery> result)
ConcurrentJob
finishProcessing
in class ConcurrentJob<MessageDelivery>
protected void updateStatusAndUnlock(MessageDelivery messageDelivery, MessageDeliveryStatus status)
messageDelivery
- the messageDelivery instance to markpublic ProcessingResult<MessageDelivery> run()
ConcurrentJob
run
in class ConcurrentJob<MessageDelivery>
public void execute(org.quartz.JobExecutionContext context) throws org.quartz.JobExecutionException
execute
in interface org.quartz.Job
org.quartz.JobExecutionException
Copyright © 2005–2016 The Kuali Foundation. All rights reserved.