Search in sources :

Example 1 with IFSATimeOutMessage

use of com.ing.ifsa.IFSATimeOutMessage in project iaf by ibissource.

the class IfsaRequesterSender method getRawReplyMessage.

/**
 * Retrieves a message with the specified correlationId from queue or other channel, but does no processing on it.
 */
private Message getRawReplyMessage(QueueSession session, IFSAQueue queue, TextMessage sentMessage) throws SenderException, TimeOutException {
    String selector = null;
    Message msg = null;
    QueueReceiver replyReceiver = null;
    try {
        replyReceiver = getReplyReceiver(session, sentMessage);
        selector = replyReceiver.getMessageSelector();
        long timeout = getExpiry(queue);
        log.debug(getLogPrefix() + "start waiting at most [" + timeout + "] ms for reply on message using selector [" + selector + "]");
        msg = replyReceiver.receive(timeout);
        if (msg == null) {
            log.info(getLogPrefix() + "received null reply");
        } else {
            log.info(getLogPrefix() + "received reply");
        }
    } catch (Exception e) {
        throw new SenderException(getLogPrefix() + "got exception retrieving reply", e);
    } finally {
        try {
            closeReplyReceiver(replyReceiver);
        } catch (IfsaException e) {
            log.error(getLogPrefix() + "error closing replyreceiver", e);
        }
    }
    if (msg == null) {
        throw new TimeOutException(getLogPrefix() + " timed out waiting for reply using selector [" + selector + "]");
    }
    if (msg instanceof IFSATimeOutMessage) {
        throw new TimeOutException(getLogPrefix() + "received IFSATimeOutMessage waiting for reply using selector [" + selector + "]");
    }
    return msg;
// try {
// TextMessage result = (TextMessage)msg;
// return result;
// } catch (Exception e) {
// throw new SenderException(getLogPrefix()+"reply received for message using selector ["+selector+"] cannot be cast to TextMessage ["+msg.getClass().getName()+"]",e);
// }
}
Also used : IfsaException(nl.nn.adapterframework.extensions.ifsa.IfsaException) TimeOutException(nl.nn.adapterframework.core.TimeOutException) IFSAReportMessage(com.ing.ifsa.IFSAReportMessage) IFSATimeOutMessage(com.ing.ifsa.IFSATimeOutMessage) Message(javax.jms.Message) TextMessage(javax.jms.TextMessage) QueueReceiver(javax.jms.QueueReceiver) IFSATimeOutMessage(com.ing.ifsa.IFSATimeOutMessage) SenderException(nl.nn.adapterframework.core.SenderException) IfsaException(nl.nn.adapterframework.extensions.ifsa.IfsaException) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) JMSException(javax.jms.JMSException) TimeOutException(nl.nn.adapterframework.core.TimeOutException) SenderException(nl.nn.adapterframework.core.SenderException) ParameterException(nl.nn.adapterframework.core.ParameterException)

Aggregations

IFSAReportMessage (com.ing.ifsa.IFSAReportMessage)1 IFSATimeOutMessage (com.ing.ifsa.IFSATimeOutMessage)1 JMSException (javax.jms.JMSException)1 Message (javax.jms.Message)1 QueueReceiver (javax.jms.QueueReceiver)1 TextMessage (javax.jms.TextMessage)1 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)1 ParameterException (nl.nn.adapterframework.core.ParameterException)1 SenderException (nl.nn.adapterframework.core.SenderException)1 TimeOutException (nl.nn.adapterframework.core.TimeOutException)1 IfsaException (nl.nn.adapterframework.extensions.ifsa.IfsaException)1