@ComponentProfile(summary="Throw an exception based on some configured criteria", tag="service,error-handling") public class ThrowExceptionService extends ServiceImp
Use this service as part of a workflow to throw an exception at a time and place of your choosing (rather than when the exception
actually occurs perhaps). The ServiceException
is generated by concrete implementations of ExceptionGenerator
; if
the generated exception is null, then no exception is thrown.
ExceptionGenerator
In the adapter configuration file this class is aliased as throw-exception-service which is the preferred alternative to the fully qualified classname when building your configuration.
log
Constructor and Description |
---|
ThrowExceptionService() |
ThrowExceptionService(ExceptionGenerator eg) |
ThrowExceptionService(java.lang.String uniqueId,
ExceptionGenerator eg) |
Modifier and Type | Method and Description |
---|---|
protected void |
closeService() |
void |
doService(AdaptrisMessage msg)
Apply the service to the message.
|
ExceptionGenerator |
getExceptionGenerator() |
protected void |
initService() |
void |
prepare()
Prepare for initialisation.
|
void |
setExceptionGenerator(ExceptionGenerator eg)
How to generate the exception for throwing.
|
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId, start, stop
public ThrowExceptionService()
public ThrowExceptionService(ExceptionGenerator eg)
public ThrowExceptionService(java.lang.String uniqueId, ExceptionGenerator eg)
public void doService(AdaptrisMessage msg) throws ServiceException
Service
Apply the service to the message.
msg
- the AdaptrisMessage
to processServiceException
- wrapping any underlying Exception
sprotected void initService() throws CoreException
initService
in class ServiceImp
CoreException
protected void closeService()
closeService
in class ServiceImp
public ExceptionGenerator getExceptionGenerator()
public void setExceptionGenerator(ExceptionGenerator eg)
eg
- the generator.public void prepare() throws CoreException
ComponentLifecycleExtension
CoreException