org.apache.uima.adapter.jms.activemq
Class JmsOutputChannel

java.lang.Object
  extended by org.apache.uima.adapter.jms.activemq.JmsOutputChannel
All Implemented Interfaces:
org.apache.uima.aae.Channel, org.apache.uima.aae.OutputChannel

public class JmsOutputChannel
extends Object
implements org.apache.uima.aae.OutputChannel


Nested Class Summary
static class JmsOutputChannel.BrokerConnectionEntry
           
protected  class JmsOutputChannel.ConnectionTimer
           
 
Field Summary
 
Fields inherited from interface org.apache.uima.aae.Channel
CloseAllChannels, InputChannels
 
Constructor Summary
JmsOutputChannel()
           
 
Method Summary
 void bindWithClientEndpoint(org.apache.uima.aae.controller.Endpoint anEndpoint)
          This method verifies that the destination (queue) exists.
 void cancelTimers()
           
 org.apache.uima.aae.controller.AnalysisEngineController getAnalysisEngineController()
           
 org.apache.activemq.ActiveMQConnectionFactory getConnectionFactory()
           
 String getControllerInputEndpoint()
           
 String getName()
           
 String getServerURI()
           
 void initialize()
           
 void sendReply(org.apache.uima.aae.InProcessCache.CacheEntry entry, org.apache.uima.aae.controller.Endpoint anEndpoint)
           
 void sendReply(int aCommand, org.apache.uima.aae.controller.Endpoint anEndpoint, String aCasReferenceId, boolean notifyOnJmsException)
           
 void sendReply(org.apache.uima.resource.metadata.ProcessingResourceMetaData aProcessingResourceMetadata, org.apache.uima.aae.controller.Endpoint anEndpoint, boolean serialize)
           
 void sendReply(Throwable t, String aCasReferenceId, String aParentCasReferenceId, org.apache.uima.aae.controller.Endpoint anEndpoint, int aCommand)
          Sends JMS Reply Message to a given endpoint.
 void sendRequest(int aCommand, String aCasReferenceId, org.apache.uima.aae.controller.Endpoint anEndpoint)
          Sends request message to a delegate.
 String serializeCAS(boolean isReply, org.apache.uima.cas.CAS aCAS, String aCasReferenceId, String aSerializerKey)
          Serializes CAS using indicated Serializer.
 void setConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory connectionFactory)
           
 void setController(org.apache.uima.aae.controller.AnalysisEngineController analysisEngineController)
           
 void setControllerInputEndpoint(String controllerInputEndpoint)
           
protected  void setFreeCasQueue(javax.jms.Destination destination)
           
 void setSecondaryInputQueue(String anEndpoint)
           
 void setServerURI(String aServerURI)
          Sets the ActiveMQ Broker URI
 void setServiceInputEndpoint(String anEnpoint)
           
 void stop()
           
 void stop(int channelsToClose)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JmsOutputChannel

public JmsOutputChannel()
Method Detail

setServerURI

public void setServerURI(String aServerURI)
Sets the ActiveMQ Broker URI

Specified by:
setServerURI in interface org.apache.uima.aae.OutputChannel

setFreeCasQueue

protected void setFreeCasQueue(javax.jms.Destination destination)

getServerURI

public String getServerURI()

getName

public String getName()
Specified by:
getName in interface org.apache.uima.aae.Channel

setConnectionFactory

public void setConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory connectionFactory)
Parameters:
connectionFactory -

setServiceInputEndpoint

public void setServiceInputEndpoint(String anEnpoint)

setSecondaryInputQueue

public void setSecondaryInputQueue(String anEndpoint)

getConnectionFactory

public org.apache.activemq.ActiveMQConnectionFactory getConnectionFactory()

initialize

public void initialize()
                throws org.apache.uima.aae.error.AsynchAEException
Specified by:
initialize in interface org.apache.uima.aae.OutputChannel
Throws:
org.apache.uima.aae.error.AsynchAEException

serializeCAS

public String serializeCAS(boolean isReply,
                           org.apache.uima.cas.CAS aCAS,
                           String aCasReferenceId,
                           String aSerializerKey)
                    throws Exception
Serializes CAS using indicated Serializer.

Parameters:
aCAS - - CAS instance to serialize
aSerializerKey - - a key identifying which serializer to use
Returns:
- String - serialized CAS as String
Throws:
Exception

bindWithClientEndpoint

public void bindWithClientEndpoint(org.apache.uima.aae.controller.Endpoint anEndpoint)
                            throws Exception
This method verifies that the destination (queue) exists. It opens a connection the a broker, creates a session and a message producer. Finally, using the message producer, sends an empty message to a queue. This API support enables checking for existence of the reply (temp) queue before any processing of a cas is done. This is an optimization to prevent expensive processing if the client destination is no longer available.

Specified by:
bindWithClientEndpoint in interface org.apache.uima.aae.OutputChannel
Throws:
Exception

sendRequest

public void sendRequest(int aCommand,
                        String aCasReferenceId,
                        org.apache.uima.aae.controller.Endpoint anEndpoint)
                 throws org.apache.uima.aae.error.AsynchAEException
Sends request message to a delegate.

Specified by:
sendRequest in interface org.apache.uima.aae.OutputChannel
Parameters:
aCommand - - the type of request [Process|GetMeta]
anEndpoint - - the destination where the delegate receives messages
Throws:
org.apache.uima.aae.error.AsynchAEException

sendReply

public void sendReply(org.apache.uima.aae.InProcessCache.CacheEntry entry,
                      org.apache.uima.aae.controller.Endpoint anEndpoint)
               throws org.apache.uima.aae.error.AsynchAEException
Specified by:
sendReply in interface org.apache.uima.aae.OutputChannel
Throws:
org.apache.uima.aae.error.AsynchAEException

sendReply

public void sendReply(int aCommand,
                      org.apache.uima.aae.controller.Endpoint anEndpoint,
                      String aCasReferenceId,
                      boolean notifyOnJmsException)
               throws org.apache.uima.aae.error.AsynchAEException
Specified by:
sendReply in interface org.apache.uima.aae.OutputChannel
Throws:
org.apache.uima.aae.error.AsynchAEException

sendReply

public void sendReply(Throwable t,
                      String aCasReferenceId,
                      String aParentCasReferenceId,
                      org.apache.uima.aae.controller.Endpoint anEndpoint,
                      int aCommand)
               throws org.apache.uima.aae.error.AsynchAEException
Sends JMS Reply Message to a given endpoint. The reply message contains given Throwable (with full stack)

Specified by:
sendReply in interface org.apache.uima.aae.OutputChannel
Parameters:
t - - Throwable to include in the reply message
anEndpoint - - an endpoint to receive the reply message
aCasReferenceId - - a unique CAS reference id
Throws:
org.apache.uima.aae.error.AsynchAEException

sendReply

public void sendReply(org.apache.uima.resource.metadata.ProcessingResourceMetaData aProcessingResourceMetadata,
                      org.apache.uima.aae.controller.Endpoint anEndpoint,
                      boolean serialize)
               throws org.apache.uima.aae.error.AsynchAEException
Specified by:
sendReply in interface org.apache.uima.aae.OutputChannel
Parameters:
aProcessingResourceMetadata -
anEndpoint -
serialize -
Throws:
org.apache.uima.aae.error.AsynchAEException

getAnalysisEngineController

public org.apache.uima.aae.controller.AnalysisEngineController getAnalysisEngineController()

setController

public void setController(org.apache.uima.aae.controller.AnalysisEngineController analysisEngineController)
Specified by:
setController in interface org.apache.uima.aae.OutputChannel

getControllerInputEndpoint

public String getControllerInputEndpoint()

setControllerInputEndpoint

public void setControllerInputEndpoint(String controllerInputEndpoint)

stop

public void stop()
Specified by:
stop in interface org.apache.uima.aae.Channel
Specified by:
stop in interface org.apache.uima.aae.OutputChannel

stop

public void stop(int channelsToClose)
Specified by:
stop in interface org.apache.uima.aae.Channel

cancelTimers

public void cancelTimers()
Specified by:
cancelTimers in interface org.apache.uima.aae.OutputChannel


Copyright © 2006-2011 The Apache Software Foundation. All Rights Reserved.