use of nl.nn.adapterframework.dispatcher.DispatcherManager in project iaf by ibissource.
the class IbisJavaSender method sendMessage.
public String sendMessage(String correlationID, String message, ParameterResolutionContext prc) throws SenderException, TimeOutException {
String result = null;
HashMap context = null;
try {
if (paramList != null) {
context = (HashMap) prc.getValueMap(paramList);
} else {
context = new HashMap();
}
DispatcherManager dm = null;
Class c = Class.forName("nl.nn.adapterframework.dispatcher.DispatcherManagerFactory");
if (getDispatchType().equalsIgnoreCase("DLL")) {
String version = nl.nn.adapterframework.dispatcher.Version.version;
if (version.contains("IbisServiceDispatcher 1.3"))
throw new SenderException("IBIS-ServiceDispatcher out of date! Please update to version 1.4 or higher");
Method getDispatcherManager = c.getMethod("getDispatcherManager", String.class);
dm = (DispatcherManager) getDispatcherManager.invoke(null, getDispatchType());
} else {
Method getDispatcherManager = c.getMethod("getDispatcherManager");
dm = (DispatcherManager) getDispatcherManager.invoke(null, (Object[]) null);
}
result = dm.processRequest(getServiceName(), correlationID, message, context);
if (isMultipartResponse()) {
return HttpSender.handleMultipartResponse(multipartResponseContentType, new ByteArrayInputStream(result.getBytes(multipartResponseCharset)), prc, null);
}
} catch (ParameterException e) {
throw new SenderException(getLogPrefix() + "exception evaluating parameters", e);
} catch (Exception e) {
throw new SenderException(getLogPrefix() + "exception processing message using request processor [" + getServiceName() + "]", e);
} finally {
if (log.isDebugEnabled() && StringUtils.isNotEmpty(getReturnedSessionKeys())) {
log.debug("returning values of session keys [" + getReturnedSessionKeys() + "]");
}
if (prc != null) {
Misc.copyContext(getReturnedSessionKeys(), context, prc.getSession());
}
}
return result;
}
Aggregations