Databases Reference
In-Depth Information
Java action
This enables us to call out to a custom java class as part of the process of handling
the fault. This class must implement the interface
IFaultRecoveryJavaClass
, which
defines two methods:
publicvoidhandleRetrySuccess(IFaultRecoveryContextctx);
publicStringhandleFault(IFaultRecoveryContextctx);
The first method
handleRetrySuccess
is called after a successful retry of an
invocation, otherwise
handleFault
is called.
This class is not intended to handle a fault, but is more for generating alerts and so
on. For example, you could use invocation of the method
handleFault
to generate a
notification that there is a problem with a particular endpoint, and likewise, use the
invocation of the method
handleRetrySuccess
to generate a notification that the
problem with the endpoint has now been resolved.
The method
handleFault
returns a string value, which can be mapped to the next
action to be invoked by the framework, for example, if we defined the following
javaAction
:
<Actionid="ora-java">
<javaAction className="mypackage.myClass"
defaultAction="ora-human-intervention">
<returnValuevalue="RETRY"ref="ora-retry"/>
<returnValuevalue="MANUAL"ref="ora-human-intervention"/>
</javaAction>
</Action>
The
javaAction
element takes two attributes:
className
, which specifies the java
class to be invoked, and
defaultAction
, which specifies the default action to be
executed upon completion of the java action.
Within the
javaAction
element, we can specify zero, one, or more
returnValue
elements, each of which maps a value returned by
handleFault
to a corresponding
follow-up action to be executed by the fault management framework.
In the previous example, we have specified for a return value of 'RETRY'. The
framework should execute the
ora-retry
action, and if a value of MANUAL is
returned, then it should execute the
ora-human-intervention
action.
If no mapping is found for the return value, then the
defaultAction
specified as
part of the
javaAction
is executed. This gives us the flexibility to calculate how we
wish to handle a particular fault at runtime.