Class JmsOutputChannel
- java.lang.Object
-
- org.apache.uima.adapter.jms.activemq.JmsOutputChannel
-
- All Implemented Interfaces:
Channel,OutputChannel
public class JmsOutputChannel extends java.lang.Object implements OutputChannel
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJmsOutputChannel.BrokerConnectionEntryprotected classJmsOutputChannel.ConnectionTimer
-
Field Summary
-
Fields inherited from interface org.apache.uima.aae.Channel
CloseAllChannels, InputChannels
-
-
Constructor Summary
Constructors Constructor Description JmsOutputChannel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbindWithClientEndpoint(Endpoint anEndpoint)This method verifies that the destination (queue) exists.voidcancelTimers()AnalysisEngineControllergetAnalysisEngineController()org.apache.activemq.ActiveMQConnectionFactorygetConnectionFactory()java.lang.StringgetControllerInputEndpoint()java.lang.StringgetName()java.lang.StringgetServerURI()voidinitialize()voidsendReply(int aCommand, Endpoint anEndpoint, java.lang.String aCasReferenceId, boolean notifyOnJmsException)voidsendReply(java.lang.Throwable t, java.lang.String aCasReferenceId, java.lang.String aParentCasReferenceId, Endpoint anEndpoint, int aCommand)Sends JMS Reply Message to a given endpoint.voidsendReply(InProcessCache.CacheEntry entry, Endpoint anEndpoint)voidsendReply(org.apache.uima.resource.metadata.ProcessingResourceMetaData aProcessingResourceMetadata, Endpoint anEndpoint, boolean serialize)voidsendRequest(int aCommand, java.lang.String aCasReferenceId, Endpoint anEndpoint)Sends request message to a delegate.java.lang.StringserializeCAS(boolean isReply, org.apache.uima.cas.CAS aCAS, java.lang.String aCasReferenceId, java.lang.String aSerializerKey)Serializes CAS using indicated Serializer.voidsetConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory connectionFactory)voidsetController(AnalysisEngineController analysisEngineController)voidsetControllerInputEndpoint(java.lang.String controllerInputEndpoint)protected voidsetFreeCasQueue(javax.jms.Destination destination)voidsetSecondaryInputQueue(java.lang.String anEndpoint)voidsetServerURI(java.lang.String aServerURI)Sets the ActiveMQ Broker URIvoidsetServiceInputEndpoint(java.lang.String anEnpoint)voidstop()voidstop(int channelsToClose)
-
-
-
Method Detail
-
setServerURI
public void setServerURI(java.lang.String aServerURI)
Sets the ActiveMQ Broker URI- Specified by:
setServerURIin interfaceOutputChannel
-
setFreeCasQueue
protected void setFreeCasQueue(javax.jms.Destination destination)
-
getServerURI
public java.lang.String getServerURI()
-
setConnectionFactory
public void setConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory connectionFactory)
- Parameters:
connectionFactory-
-
setServiceInputEndpoint
public void setServiceInputEndpoint(java.lang.String anEnpoint)
-
setSecondaryInputQueue
public void setSecondaryInputQueue(java.lang.String anEndpoint)
-
getConnectionFactory
public org.apache.activemq.ActiveMQConnectionFactory getConnectionFactory()
-
initialize
public void initialize() throws AsynchAEException- Specified by:
initializein interfaceOutputChannel- Throws:
AsynchAEException
-
serializeCAS
public java.lang.String serializeCAS(boolean isReply, org.apache.uima.cas.CAS aCAS, java.lang.String aCasReferenceId, java.lang.String aSerializerKey) throws java.lang.ExceptionSerializes CAS using indicated Serializer.- Parameters:
aCAS- - CAS instance to serializeaSerializerKey- - a key identifying which serializer to use- Returns:
- - String - serialized CAS as String
- Throws:
java.lang.Exception
-
bindWithClientEndpoint
public void bindWithClientEndpoint(Endpoint anEndpoint) throws java.lang.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:
bindWithClientEndpointin interfaceOutputChannel- Throws:
java.lang.Exception
-
sendRequest
public void sendRequest(int aCommand, java.lang.String aCasReferenceId, Endpoint anEndpoint) throws AsynchAEExceptionSends request message to a delegate.- Specified by:
sendRequestin interfaceOutputChannel- Parameters:
aCommand- - the type of request [Process|GetMeta]anEndpoint- - the destination where the delegate receives messages- Throws:
AsynchAEException
-
sendReply
public void sendReply(InProcessCache.CacheEntry entry, Endpoint anEndpoint) throws AsynchAEException
- Specified by:
sendReplyin interfaceOutputChannel- Throws:
AsynchAEException
-
sendReply
public void sendReply(int aCommand, Endpoint anEndpoint, java.lang.String aCasReferenceId, boolean notifyOnJmsException) throws AsynchAEException- Specified by:
sendReplyin interfaceOutputChannel- Throws:
AsynchAEException
-
sendReply
public void sendReply(java.lang.Throwable t, java.lang.String aCasReferenceId, java.lang.String aParentCasReferenceId, Endpoint anEndpoint, int aCommand) throws AsynchAEExceptionSends JMS Reply Message to a given endpoint. The reply message contains given Throwable (with full stack)- Specified by:
sendReplyin interfaceOutputChannel- Parameters:
t- - Throwable to include in the reply messageanEndpoint- - an endpoint to receive the reply messageaCasReferenceId- - a unique CAS reference id- Throws:
AsynchAEException
-
sendReply
public void sendReply(org.apache.uima.resource.metadata.ProcessingResourceMetaData aProcessingResourceMetadata, Endpoint anEndpoint, boolean serialize) throws AsynchAEException- Specified by:
sendReplyin interfaceOutputChannel- Parameters:
aProcessingResourceMetadata-anEndpoint-serialize-- Throws:
AsynchAEException
-
getAnalysisEngineController
public AnalysisEngineController getAnalysisEngineController()
-
setController
public void setController(AnalysisEngineController analysisEngineController)
- Specified by:
setControllerin interfaceOutputChannel
-
getControllerInputEndpoint
public java.lang.String getControllerInputEndpoint()
-
setControllerInputEndpoint
public void setControllerInputEndpoint(java.lang.String controllerInputEndpoint)
-
stop
public void stop()
- Specified by:
stopin interfaceChannel- Specified by:
stopin interfaceOutputChannel
-
cancelTimers
public void cancelTimers()
- Specified by:
cancelTimersin interfaceOutputChannel
-
-