Interface SweepActionHandler.SweepItem
-
- Enclosing interface:
- SweepActionHandler
public static interface SweepActionHandler.SweepItem
A subinterface for getting an instance of a class targeted by a custom sweep (CmCustomQueueJob
,CmCustomSweepPolicy
, orCmCustomQueueSweep
). A custom sweep passes an array ofSweepItem
objects to aSweepActionHandler
implementation for processing. You can set a status value on aSweepItem
object, indicating the processing outcome for an instance. For a queue sweep, you can also defer processing of a queue entry for a specified period of time.
-
-
Method Summary
Methods Modifier and Type Method and Description IndependentlyPersistableObject
getTarget()
Gets an instance of a class targeted by a custom sweep.void
setDeferral(int deferralSeconds, byte[] deferralData)
Intended for objects returned by a queue sweep, this method specifies that processing of a queue entry should be deferred for at least a minimum period of time before re-processing, and optionally specifies binary data to be stored in the DeferralData property of the queue entry for use when that re-processing occurs.void
setOutcome(SweepItemOutcome outcome, java.lang.String description)
Informs the sweep service of the status of each sweep item passed to the handler.
-
-
-
Method Detail
-
getTarget
IndependentlyPersistableObject getTarget()
Gets an instance of a class targeted by a custom sweep.
-
setOutcome
void setOutcome(SweepItemOutcome outcome, java.lang.String description)
Informs the sweep service of the status of each sweep item passed to the handler. Every sweep item in the array that is passed to a sweep handler is initialized toIGNORED
. Sweep items that are left in theIGNORED
state are not added to the examined, processed, and failed counters that are maintained by the sweep service. In general, custom sweep handler implementations should call this method on each item in the array and set it to a processed or failed state.For queue sweeps, it's especially important to not leave a sweep item with an outcome of
IGNORED
. When the sweep service encounters a queue sweep item in anIGNORED
state, it leaves the item in the queue table and does not increment the number of retries. This causes the item to be retried indefinitely until the handler explicitly sets the outcome parameter to eitherFAILED
,FAILED_NO_RETRY
, orPROCESSED
.For a queue sweep item successfully processed, set the outcome to
PROCESSED
, and the sweep service will remove the item from the queue table. Set the outcome toFAILED
orFAILED_NO_RETRY
if the handler encounters an error attempting to process an item. An item marked asFAILED
is retried until successful, or until the number of retries is equal to the value that is set on the QueueSweep.MaximumFailures property. Set the outcome toFAILED_NO_RETRY
if you know that the failure is not ephemeral and will never succeed after a retry.For sweep jobs and sweep policies, the server can persist
CmSweepResult
objects for failure outcomes. Generating these objects requires the following combination of settings:- the outcome parameter of this method is set to
FAILED
orFAILED_NO_RETRY
. - the SweepMode property on the sweep job or sweep policy is set to SWEEP_MODE_NORMAL. A sweep job must also have its RecordFailures property set to TRUE.
- Parameters:
outcome
- TheSweepItemOutcome
field that indicates the result of processing this object.description
- A message that explains a processing failure of aSweepItem
object. The message is persisted in the FailureDescription property of theCmSweepResult
object.
- the outcome parameter of this method is set to
-
setDeferral
void setDeferral(int deferralSeconds, byte[] deferralData)
Intended for objects returned by a queue sweep, this method specifies that processing of a queue entry should be deferred for at least a minimum period of time before re-processing, and optionally specifies binary data to be stored in the DeferralData property of the queue entry for use when that re-processing occurs. The method allows time for an asynchronous operation performed on a queue entry to complete. The method will not affect the queue sweep processed object counter.- Parameters:
deferralSeconds
- The minimum number of seconds by which to defer processing.deferralData
- Optional data to be stored in the DeferralData property.
-
-