Search in sources :

Example 21 with ListenerException

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);
    }
}
Also used : ListenerException(nl.nn.adapterframework.core.ListenerException) IFSAServiceName(com.ing.ifsa.IFSAServiceName) IfsaException(nl.nn.adapterframework.extensions.ifsa.IfsaException) ListenerException(nl.nn.adapterframework.core.ListenerException) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) JMSException(javax.jms.JMSException) IFSAServicesProvided(com.ing.ifsa.IFSAServicesProvided)

Example 22 with ListenerException

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);
    }
}
Also used : IfsaException(nl.nn.adapterframework.extensions.ifsa.IfsaException) ListenerException(nl.nn.adapterframework.core.ListenerException) HashMap(java.util.HashMap) QueueReceiver(javax.jms.QueueReceiver) HashMap(java.util.HashMap) Map(java.util.Map) QueueSession(javax.jms.QueueSession)

Example 23 with ListenerException

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);
    }
}
Also used : IfsaException(nl.nn.adapterframework.extensions.ifsa.IfsaException) ListenerException(nl.nn.adapterframework.core.ListenerException)

Example 24 with ListenerException

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);
            }
        }
    }
}
Also used : ListenerException(nl.nn.adapterframework.core.ListenerException) IfsaException(nl.nn.adapterframework.extensions.ifsa.IfsaException) IFSAPoisonMessage(com.ing.ifsa.IFSAPoisonMessage) Message(javax.jms.Message) IFSAMessage(com.ing.ifsa.IFSAMessage) TextMessage(javax.jms.TextMessage) QueueSession(javax.jms.QueueSession)

Example 25 with ListenerException

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);
    }
}
Also used : ListenerException(nl.nn.adapterframework.core.ListenerException) IFSAServiceName(com.ing.ifsa.IFSAServiceName) IfsaException(nl.nn.adapterframework.extensions.ifsa.IfsaException) ListenerException(nl.nn.adapterframework.core.ListenerException) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) JMSException(javax.jms.JMSException) IFSAServicesProvided(com.ing.ifsa.IFSAServicesProvided)

Aggregations

ListenerException (nl.nn.adapterframework.core.ListenerException)84 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)37 IOException (java.io.IOException)19 HashMap (java.util.HashMap)18 Map (java.util.Map)18 JMSException (javax.jms.JMSException)16 SenderException (nl.nn.adapterframework.core.SenderException)14 SQLException (java.sql.SQLException)13 PreparedStatement (java.sql.PreparedStatement)11 Session (javax.jms.Session)10 LinkedHashMap (java.util.LinkedHashMap)9 IPipeLineSession (nl.nn.adapterframework.core.IPipeLineSession)9 TimeOutException (nl.nn.adapterframework.core.TimeOutException)9 IfsaException (nl.nn.adapterframework.extensions.ifsa.IfsaException)9 Connection (java.sql.Connection)8 ResultSet (java.sql.ResultSet)8 QueueSession (javax.jms.QueueSession)8 File (java.io.File)7 MessageConsumer (javax.jms.MessageConsumer)7 Message (javax.jms.Message)6