Java Reference
In-Depth Information
Using a WebLogic Reliable Messaging Error Handler
Problem
You want to invoke a reliable messaging-enabled service in WebLogic 10 from another ser-
vice.
Solution
Use the proprietary classes that ship with WebLogic for just such a purpose. You don't have
to do anything special to inject a port type reference. Just call the method you want to call, as
you normally would. But you can configure an error handler that receives the timeout event if
the RM runtime determines that the operation won't return as planned:
import weblogic.jws.ReliabilityErrorHandler;
import weblogic.wsee.reliability.ReliabilityErrorContext;
import weblogic.wsee.reliability.ReliableDeliveryException;
//...
@ReliabilityErrorHandler(target="port")
public void onReliableMessageDeliveryError(ReliabilityErrorContext ctx)
{
ReliableDeliveryException fault = ctx.getFault();
String msg = "";
if (fault != null) {
msg = ctx.getFault().getMessage();
}
String op = ctx.getOperationName();
System.out.println("Reliable operation " + op +
" was probably lost. Message=" + message);
}
The event will get received by a handler method that fulfills two requirements: it is annotated
with @ReliabilityErrorHandler , and it accepts a ReliabilityErrorContext parameter.
The code above accepts the context, which you can use to retrieve the fault and process further
as you wish. Note that the error context also allows you to get the name of the operation that
the runtime was trying to invoke when it failed. This entire solution is, of course, specific to
WebLogic 10.
Search WWH ::




Custom Search