You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by cw...@apache.org on 2014/07/16 18:27:59 UTC

svn commit: r1611071 - /uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/DuccTransportConfiguration.java

Author: cwiklik
Date: Wed Jul 16 16:27:59 2014
New Revision: 1611071

URL: http://svn.apache.org/r1611071
Log:
UIMA-3948 enforce failover on jms endpoint only for tcp based urls. 

Modified:
    uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/DuccTransportConfiguration.java

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/DuccTransportConfiguration.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/DuccTransportConfiguration.java?rev=1611071&r1=1611070&r2=1611071&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/DuccTransportConfiguration.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/DuccTransportConfiguration.java Wed Jul 16 16:27:59 2014
@@ -46,18 +46,26 @@ public class DuccTransportConfiguration 
 //	      duccAMQComponent = ActiveMQComponent.activeMQComponent(brokerUrl);
 	      duccAMQComponent = new ActiveMQComponent(context);
 	      
-			// Split decoration from the broker uri. The code below enforces failover which
-			// has syntax: failover(<broker uri>)?<decoration>
-			int pos = brokerUrl.indexOf("?");
-			String decoration = "";
-			if (pos > -1) {
-				decoration = brokerUrl.substring(pos);
+			String connectURL = "";
+			// if provided broker url is tcp based, enforce the failover to enable recovery after
+			// switch/network failures
+			if ( brokerUrl.trim().startsWith("tcp://")) {
+				// Split decoration from the broker uri. The code below enforces failover which
+				// has syntax: failover(<broker uri>)?<decoration>
+				int pos = brokerUrl.indexOf("?");
+				String decoration = "";
+				if (pos > -1) {
+					decoration = brokerUrl.substring(pos);
+				}
+
+				brokerUrl = brokerUrl.substring(0, pos);
+				connectURL = "failover:(" + brokerUrl + ")" + decoration;
+			} else {
+				connectURL = brokerUrl;
 			}
-			brokerUrl = brokerUrl.substring(0, pos);
-			duccAMQComponent.setBrokerURL("failover:(" + brokerUrl + ")"
-					+ decoration);
-			logger.info("configureJMSTransport", null, "broker URL:"
-					+ "failover:(" + brokerUrl + ")" + decoration);
+			duccAMQComponent.setBrokerURL(connectURL);
+
+			logger.info("configureJMSTransport", null, "Broker URL: "+connectURL);
 	      
 	      logger.info("configureJMSTransport", null, "brokerCredentialsFile:"+brokerCredentialsFile);
 	      if ( brokerCredentialsFile != null ) {