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 2009/07/01 21:14:14 UTC

svn commit: r790317 - /incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsOutputChannel.java

Author: cwiklik
Date: Wed Jul  1 19:14:13 2009
New Revision: 790317

URL: http://svn.apache.org/viewvc?rev=790317&view=rev
Log:
UIMA-1391 Added new sendReply() method to return CasMultiplier's FreeCas queue to the client

Modified:
    incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsOutputChannel.java

Modified: incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsOutputChannel.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsOutputChannel.java?rev=790317&r1=790316&r2=790317&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsOutputChannel.java (original)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsOutputChannel.java Wed Jul  1 19:14:13 2009
@@ -762,6 +762,64 @@
 		}
 		
 	}
+  public void sendReply( int aCommand, Endpoint anEndpoint, String aCasReferenceId ) throws AsynchAEException {
+    try
+    {
+      if ( aborting )
+      {
+        return;
+      }
+      anEndpoint.setReplyEndpoint(true);
+      JmsEndpointConnection_impl endpointConnection = 
+        getEndpointConnection(anEndpoint);
+
+      TextMessage tm = endpointConnection.produceTextMessage(null);
+      tm.setIntProperty(AsynchAEMessage.Payload, AsynchAEMessage.None); 
+      populateHeaderWithResponseContext(tm, anEndpoint, aCommand);
+      tm.setStringProperty(AsynchAEMessage.CasReference, aCasReferenceId);
+
+      //  If this service is a Cas Multiplier add to the message a FreeCasQueue. 
+      //  The client may need send Stop request to that queue.
+      if ( aCommand == AsynchAEMessage.ServiceInfo && 
+           getAnalysisEngineController().isCasMultiplier() &&
+           freeCASTempQueue != null ) {
+          //  Attach a temp queue to the outgoing message. This a queue where
+          //  Free CAS notifications need to be sent from the client
+          tm.setJMSReplyTo(freeCASTempQueue);
+      }
+      endpointConnection.send(tm, 0, false); 
+      addIdleTime(tm);
+      if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINE)) {
+        UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, CLASS_NAME.getName(),
+                    "sendReply", JmsConstants.JMS_LOG_RESOURCE_BUNDLE, "UIMAJMS_cpc_reply_sent__FINE",
+                    new Object[] { getAnalysisEngineController().getComponentName(), anEndpoint.getEndpoint()});
+      }
+    }
+    catch( JMSException e)
+    {
+      //  Unable to establish connection to the endpoint. Logit and continue
+      if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
+        UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
+                    "sendReply", JmsConstants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_exception__WARNING",
+                    new Object[] { e});
+      }
+    }
+
+    catch( ServiceShutdownException e)
+    {
+      e.printStackTrace();
+    }
+
+    catch (AsynchAEException e)
+    {
+      throw e;
+    }
+    catch ( Exception e)
+    {
+      throw new AsynchAEException(e);
+    }
+    
+  }
 
 	public void sendReply( int aCommand, Endpoint anEndpoint ) throws AsynchAEException
 	{
@@ -772,7 +830,6 @@
 			{
 				return;
 			}
-			anEndpoint.setReplyEndpoint(true);
 			JmsEndpointConnection_impl endpointConnection = 
 				getEndpointConnection(anEndpoint);