Asynchronous (buffered) messages are implemented using a JMS (Java Message Service) queue. If a message cannot be delivered from the queue, an onAsyncFailure event will be raised. Before the event is raised, redelivery is attempted at the interval specified by the retry-delay property, and for the number of attempts specified by the retry-count property.
The onAsyncFailure event can be handled by an appropriate event handler. If the buffered message that failed to be delivered is a method that is buffered on a service control, then the onAsyncFailure event handler will be a method named controlvar_onAsyncFailure( String methodname, Object[] args ). Note that when this event is raised, the message failed to leave the caller (i.e., the method did not fail on the receiving side, but failed on the sending side.)
Possible causes for this include specifying an invalid URL in a service request or providing invalid security credentials.
If an inbound-message to a JWS is buffered, and it fails to leave the JMS queue, then the event handler is contextvar_onAsyncFailure( String methodname, Object[] args ) is raised. This may happen when an exception causes a transaction to rollback.
The following example causes the OnAsyncFailure event to be raised when the throwAnException() and callWithBogusEndpoint() methods are called.
MyJws.jwspublic class MyJws extends com.bea.jws.WebService { /** @common:context */ JwsContext ctx; /** @common:control */ MyJcx ctrl; /** * this method will be received by the weblogic server, but will never leave the JMS queue because * this method always throws an exception (and the transaction always rolls back ). * * @common:operation * @common:message-buffer enable="true" */ public void throwAnException() { throw new Exception("intentional exception"); } public void callWithBogusEndpoint() { ctrl.bogusEndpoint(); } ctx_onAsyncFailure( String methodName, Object[] args ) { System.out.println(" event handler is ctx_onAsyncFailure "); System.out.println(" methodName = " + methodName ); for ( int i = 0; i<args.length; i++ ) System.out.println(" args[" + i + "] = " + args[i] ); } ctrl_onAsyncFailure( String methodName, Object[] args ) { System.out.println(" event handler is ctrl_onAsyncFailure "); System.out.println(" methodName = " + methodName ); for ( int i = 0; i<args.length; i++ ) System.out.println(" args[" + i + "] = " + args[i] ); } }MyJcx.jcx
/** @jc:location http-url="http://bogus.bugus.bogus/bogus.jws */ public interface MyJcx extends com.bea.control.ControlExtension, com.bea.control.ServiceControl { /** * calls to this method will never leave the sender because the endpoint is bogus * * @common:message-buffer enable="true" */ public void bogusEnpoint(); }