}
public void handle(Object anObjectToHandle) throws AsynchAEException {
super.validate(anObjectToHandle);
MessageContext messageContext = (MessageContext) anObjectToHandle;
if (isHandlerForMessage(messageContext, AsynchAEMessage.Response, AsynchAEMessage.Process)
|| isHandlerForMessage(messageContext, AsynchAEMessage.Response, AsynchAEMessage.ACK)
|| isHandlerForMessage(messageContext, AsynchAEMessage.Response,
AsynchAEMessage.ServiceInfo)
|| isHandlerForMessage(messageContext, AsynchAEMessage.Response,
AsynchAEMessage.CollectionProcessComplete)) {
int payload = messageContext.getMessageIntProperty(AsynchAEMessage.Payload);
int command = messageContext.getMessageIntProperty(AsynchAEMessage.Command);
String delegate = ((Endpoint) messageContext.getEndpoint()).getEndpoint();
String key = null;
String fromServer = null;
if (getController() instanceof AggregateAnalysisEngineController) {
if (((Endpoint) messageContext.getEndpoint()).isRemote()) {
if (((MessageContext) anObjectToHandle).propertyExists(AsynchAEMessage.EndpointServer)) {
fromServer = ((MessageContext) anObjectToHandle)
.getMessageStringProperty(AsynchAEMessage.EndpointServer);
}
// If old service does not echo back the external broker name then the queue name must be
// unique.
// Can't use the ServerURI set by the service as it may be its local name for the broker,
// e.g. tcp://localhost:61616
}
key = ((AggregateAnalysisEngineController) getController()).lookUpDelegateKey(delegate,
fromServer);
}
if (AsynchAEMessage.CASRefID == payload) {
handleProcessResponseWithCASReference(messageContext);
if (key != null) {
resetErrorCounts(key);
}
} else if (AsynchAEMessage.XMIPayload == payload || AsynchAEMessage.BinaryPayload == payload) {
handleProcessResponseFromRemote(messageContext, key);
if (key != null) {
resetErrorCounts(key);
}
} else if (AsynchAEMessage.Exception == payload) {
if (key == null) {
key = ((Endpoint) messageContext.getEndpoint()).getEndpoint();
}
handleProcessResponseWithException(messageContext, key);
} else if (AsynchAEMessage.None == payload
&& AsynchAEMessage.CollectionProcessComplete == command) {
if (key == null) {
key = ((Endpoint) messageContext.getEndpoint()).getEndpoint();
}
handleCollectionProcessCompleteReply(messageContext, key);
} else if (AsynchAEMessage.None == payload && AsynchAEMessage.ACK == command) {
handleACK(messageContext, key);
} else if (AsynchAEMessage.None == payload && AsynchAEMessage.Ping == command) {