You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sandesha-dev@ws.apache.org by ml...@apache.org on 2007/09/13 18:21:59 UTC

svn commit: r575359 - /webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/client/SandeshaClient.java

Author: mlovett
Date: Thu Sep 13 09:21:58 2007
New Revision: 575359

URL: http://svn.apache.org/viewvc?rev=575359&view=rev
Log:
When the client uses the RM SPI to create a Sequence, use an async replyTo if they have chosen to use a separate listener

Modified:
    webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/client/SandeshaClient.java

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/client/SandeshaClient.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/client/SandeshaClient.java?rev=575359&r1=575358&r2=575359&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/client/SandeshaClient.java (original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/client/SandeshaClient.java Thu Sep 13 09:21:58 2007
@@ -43,6 +43,7 @@
 import org.apache.axis2.description.AxisOperationFactory;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.TransportOutDescription;
 import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -356,6 +357,38 @@
 		// cleanup previous sequence
 		cleanupTerminatedSequence(to, oldSequenceKey, SandeshaUtil.getSandeshaStorageManager(configurationContext, configurationContext.getAxisConfiguration()));
 		
+		// If the client requested async operations, mint a replyTo EPR
+		boolean resetReply = false;
+		if(options.isUseSeparateListener() && options.getReplyTo() == null) {
+			try {
+				if(log.isDebugEnabled()) log.debug("Creating replyTo EPR");
+				
+				// Try to work out which transport to use. If the user didn't choose one
+				// then we use the To address to take a guess.
+				TransportOutDescription senderTransport = options.getTransportOut();
+				String transportName = null;
+				if(senderTransport != null) {
+					transportName = senderTransport.getName();
+				}
+
+				if(transportName == null) {
+					int index = to.indexOf(':');
+					if(index > 0) transportName = to.substring(0, index);
+				}
+
+				EndpointReference replyTo = serviceContext.getMyEPR(transportName);
+				if(replyTo != null) {
+					options.setReplyTo(replyTo);
+					resetReply = true;
+				}
+				
+				if(log.isDebugEnabled()) log.debug("Created replyTo EPR: " + replyTo);
+
+			} catch(AxisFault e) {
+				if(log.isDebugEnabled()) log.debug("Caught exception", e);
+				throw new SandeshaException(e);
+			}
+		}
 		try {			
 			//just to inform the sender.
 			serviceClient.fireAndForget (null);
@@ -364,6 +397,7 @@
 		}
 		finally {
 			options.setAction(oldAction);
+			if(resetReply) options.setReplyTo(null);
 			
 			options.setProperty(SandeshaClientConstants.DUMMY_MESSAGE, Sandesha2Constants.VALUE_FALSE);
 			options.setProperty(SandeshaClientConstants.SEQUENCE_KEY, oldSequenceKey);



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org