public class FaultTolerantStepFactoryBean<T,S> extends SimpleStepFactoryBean<T,S>
setSkipLimit(int)
to set how many exceptions of setSkippableExceptionClasses(Map)
types are tolerated.
Skippable exceptions on write will by default cause transaction rollback - to avoid rollback for specific exception
class include it in the transaction attribute as "no rollback for".SimpleStepFactoryBean
logger
Constructor and Description |
---|
FaultTolerantStepFactoryBean() |
Modifier and Type | Method and Description |
---|---|
protected void |
applyConfiguration(SimpleStepBuilder<T,S> builder) |
protected SimpleStepBuilder<T,S> |
createBuilder(java.lang.String name) |
void |
setBackOffPolicy(org.springframework.retry.backoff.BackOffPolicy backOffPolicy)
Public setter for the
BackOffPolicy . |
void |
setCacheCapacity(int cacheCapacity)
Public setter for the capacity of the cache in the retry policy.
|
void |
setKeyGenerator(KeyGenerator keyGenerator)
The
KeyGenerator to use to identify failed items across rollback. |
void |
setNoRollbackExceptionClasses(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> noRollbackExceptionClasses)
Exception classes that are candidates for no rollback.
|
void |
setProcessorTransactional(boolean processorTransactional) |
void |
setRetryableExceptionClasses(java.util.Map<java.lang.Class<? extends java.lang.Throwable>,java.lang.Boolean> retryableExceptionClasses)
Public setter for the retryable exceptions classifier map (from throwable class to boolean, true is retryable).
|
void |
setRetryContextCache(org.springframework.retry.policy.RetryContextCache retryContextCache)
Override the default retry context cache for retry of chunk processing.
|
void |
setRetryLimit(int retryLimit)
Public setter for the retry limit.
|
void |
setRetryListeners(org.springframework.retry.RetryListener... retryListeners)
Public setter for the
RetryListener s. |
void |
setRetryPolicy(org.springframework.retry.RetryPolicy retryPolicy)
Setter for the retry policy.
|
void |
setSkipLimit(int skipLimit)
A limit that determines skip policy.
|
void |
setSkippableExceptionClasses(java.util.Map<java.lang.Class<? extends java.lang.Throwable>,java.lang.Boolean> exceptionClasses)
Exception classes that when raised won't crash the job but will result in the item which handling caused the
exception being skipped.
|
void |
setSkipPolicy(SkipPolicy skipPolicy)
A
SkipPolicy that determines the outcome of an exception when processing an item. |
getChunkOperations, getExceptionHandler, getItemProcessor, getItemReader, getItemWriter, getListeners, getName, getObject, getObjectType, getStepOperations, getTaskExecutor, getTransactionAttribute, isReaderTransactionalQueue, isSingleton, setAllowStartIfComplete, setBeanName, setChunkCompletionPolicy, setChunkOperations, setCommitInterval, setExceptionHandler, setIsolation, setIsReaderTransactionalQueue, setItemProcessor, setItemReader, setItemWriter, setJobRepository, setListeners, setPropagation, setSingleton, setStartLimit, setStepOperations, setStreams, setTaskExecutor, setThrottleLimit, setTransactionManager, setTransactionTimeout
public void setKeyGenerator(KeyGenerator keyGenerator)
KeyGenerator
to use to identify failed items across rollback. Not used in the case of the
transactional queue flag
being false (the default).keyGenerator
- the KeyGenerator
to setpublic void setRetryPolicy(org.springframework.retry.RetryPolicy retryPolicy)
retryPolicy
- a stateless RetryPolicy
public void setRetryLimit(int retryLimit)
retryLimit == 1
by default.retryLimit
- the retry limit to set, must be greater or equal to 1.public void setCacheCapacity(int cacheCapacity)
MapRetryContextCache
.setRetryContextCache(RetryContextCache)
is set directly.cacheCapacity
- the cache capacity to set (greater than 0 else ignored)public void setRetryContextCache(org.springframework.retry.policy.RetryContextCache retryContextCache)
setCacheCapacity(int)
is ignored.retryContextCache
- the RetryContextCache
to setpublic void setRetryableExceptionClasses(java.util.Map<java.lang.Class<? extends java.lang.Throwable>,java.lang.Boolean> retryableExceptionClasses)
retryableExceptionClasses
- the retryableExceptionClasses to setpublic void setBackOffPolicy(org.springframework.retry.backoff.BackOffPolicy backOffPolicy)
BackOffPolicy
.backOffPolicy
- the BackOffPolicy
to setpublic void setRetryListeners(org.springframework.retry.RetryListener... retryListeners)
RetryListener
s.retryListeners
- the RetryListener
s to setpublic void setSkipLimit(int skipLimit)
skipLimit
- the value to set. Default is 0 (never skip).public void setSkipPolicy(SkipPolicy skipPolicy)
SkipPolicy
that determines the outcome of an exception when processing an item. Overrides the
skipLimit
. The skippableExceptionClasses
are also ignored if this is set.skipPolicy
- the SkipPolicy
to setpublic void setSkippableExceptionClasses(java.util.Map<java.lang.Class<? extends java.lang.Throwable>,java.lang.Boolean> exceptionClasses)
skip limit
as well.
exceptionClasses
- defaults to Exception
public void setNoRollbackExceptionClasses(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> noRollbackExceptionClasses)
Step
can not honour the no rollback hint in
all circumstances, but any exception on this list is counted as skippable, so even if there has to be a rollback,
then the step will not fail as long as the skip limit is not breached.
noRollbackExceptionClasses
- the exception classes to setpublic void setProcessorTransactional(boolean processorTransactional)
processorTransactional
- protected SimpleStepBuilder<T,S> createBuilder(java.lang.String name)
createBuilder
in class SimpleStepFactoryBean<T,S>
protected void applyConfiguration(SimpleStepBuilder<T,S> builder)
applyConfiguration
in class SimpleStepFactoryBean<T,S>