*
* @throws AsynchAEException
*/
public void sendRequest(int aCommand, String aCasReferenceId, Endpoint anEndpoint)
throws AsynchAEException {
Delegate delegate = null;
try {
JmsEndpointConnection_impl endpointConnection = getEndpointConnection(anEndpoint);
Message tm = endpointConnection.produceTextMessage("");
tm.setIntProperty(AsynchAEMessage.Payload, AsynchAEMessage.None);
switch(aCommand) {
case AsynchAEMessage.CollectionProcessComplete:
logRequest("UIMAEE_send_cpc_req__FINE", anEndpoint);
break;
case AsynchAEMessage.ReleaseCAS:
tm.setStringProperty(AsynchAEMessage.CasReference, aCasReferenceId);
logRequest("UIMAJMS_releasecas_request__endpoint__FINEST", anEndpoint);
break;
case AsynchAEMessage.GetMeta:
delegate = startGetMetaTimerAndGetDelegate(anEndpoint);
logRequest("UIMAEE_service_sending_getmeta_request__FINE", anEndpoint);
break;
case AsynchAEMessage.Stop:
tm.setStringProperty(AsynchAEMessage.CasReference, aCasReferenceId);
logRequest("UIMAEE_service_sending_stop_request__FINE", anEndpoint);
break;
case AsynchAEMessage.Process:
logRequest("UIMAEE_service_sending_process_request__FINE", anEndpoint);
serializeCasAndSend(getAnalysisEngineController().
getInProcessCache().
getCacheEntryForCAS(aCasReferenceId), anEndpoint);
return; /// <<<<< RETURN - Done here >>>>
};
populateHeaderWithRequestContext(tm, anEndpoint, aCommand);
// For remotes add a special property to the message. This property
// will be echoed back by the service. This property enables matching
// the reply with the right endpoint object managed by the aggregate.
tm.setStringProperty(AsynchAEMessage.EndpointServer, anEndpoint.getServerURI());
if (endpointConnection.send(tm, 0, true) != true) {
throw new ServiceNotFoundException();
}
} catch (AsynchAEException e) {
throw e;
} catch (Exception e) {
if (delegate != null && aCommand == AsynchAEMessage.GetMeta) {
delegate.cancelDelegateGetMetaTimer();
}
// Handle the error
ErrorContext errorContext = new ErrorContext();
errorContext.add(AsynchAEMessage.Command, aCommand);
errorContext.add(AsynchAEMessage.Endpoint, anEndpoint);