use of nl.nn.adapterframework.core.ListenerException in project iaf by ibissource.
the class PullingIfsaProviderListener method open.
public void open() throws ListenerException {
try {
openService();
IFSAServicesProvided services = getServiceQueue().getIFSAServicesProvided();
for (int i = 0; i < services.getNumberOfServices(); i++) {
IFSAServiceName service = services.getService(i);
String protocol = (service.IsFireAndForgetService() ? "Fire and Forget" : "Request/Reply");
log.info(getLogPrefix() + "providing ServiceName [" + service.getServiceName() + "] ServiceGroup [" + service.getServiceGroup() + "] protocol [" + protocol + "] ServiceVersion [" + service.getServiceVersion() + "]");
}
} catch (Exception e) {
throw new ListenerException(getLogPrefix(), e);
}
}
use of nl.nn.adapterframework.core.ListenerException in project iaf by ibissource.
the class PullingIfsaProviderListener method openThread.
public Map openThread() throws ListenerException {
Map threadContext = new HashMap();
try {
if (!isSessionsArePooled()) {
QueueSession session = createSession();
threadContext.put(THREAD_CONTEXT_SESSION_KEY, session);
QueueReceiver receiver;
receiver = getServiceReceiver(session);
threadContext.put(THREAD_CONTEXT_RECEIVER_KEY, receiver);
}
return threadContext;
} catch (IfsaException e) {
throw new ListenerException(getLogPrefix() + "exception in openThread()", e);
}
}
use of nl.nn.adapterframework.core.ListenerException in project iaf by ibissource.
the class PushingIfsaProviderListener method close.
public void close() throws ListenerException {
try {
jmsConnector.stop();
closeService();
} catch (IfsaException e) {
throw new ListenerException(getLogPrefix(), e);
}
}
use of nl.nn.adapterframework.core.ListenerException in project iaf by ibissource.
the class PushingIfsaProviderListener method afterMessageProcessed.
public void afterMessageProcessed(PipeLineResult plr, Object rawMessage, Map threadContext) throws ListenerException {
QueueSession session = (QueueSession) threadContext.get(IListenerConnector.THREAD_CONTEXT_SESSION_KEY);
// on request-reply send the reply.
if (getMessageProtocolEnum().equals(IfsaMessageProtocolEnum.REQUEST_REPLY)) {
Message originalRawMessage;
if (rawMessage instanceof Message) {
originalRawMessage = (Message) rawMessage;
} else {
originalRawMessage = (Message) threadContext.get(THREAD_CONTEXT_ORIGINAL_RAW_MESSAGE_KEY);
}
if (originalRawMessage == null) {
String cid = (String) threadContext.get(IPipeLineSession.businessCorrelationIdKey);
log.warn(getLogPrefix() + "no original raw message found for correlationId [" + cid + "], cannot send result");
} else {
if (session == null) {
throw new ListenerException(getLogPrefix() + "no session found in context, cannot send result");
}
try {
String result = "<exception>no result</exception>";
if (plr != null && plr.getResult() != null) {
result = plr.getResult();
}
sendReply(session, originalRawMessage, result);
} catch (IfsaException e) {
try {
sendReply(session, originalRawMessage, "<exception>" + e.getMessage() + "</exception>");
} catch (IfsaException e2) {
log.warn(getLogPrefix() + "exception sending errormessage as reply", e2);
}
throw new ListenerException(getLogPrefix() + "Exception on sending result", e);
}
}
}
}
use of nl.nn.adapterframework.core.ListenerException in project iaf by ibissource.
the class PushingIfsaProviderListener method open.
public void open() throws ListenerException {
try {
openService();
IFSAServicesProvided services = getServiceQueue().getIFSAServicesProvided();
for (int i = 0; i < services.getNumberOfServices(); i++) {
IFSAServiceName service = services.getService(i);
String protocol = (service.IsFireAndForgetService() ? "Fire and Forget" : "Request/Reply");
log.info(getLogPrefix() + "providing ServiceName [" + service.getServiceName() + "] ServiceGroup [" + service.getServiceGroup() + "] protocol [" + protocol + "] ServiceVersion [" + service.getServiceVersion() + "]");
}
jmsConnector.start();
} catch (Exception e) {
throw new ListenerException(getLogPrefix(), e);
}
}
Aggregations