Search in sources :

Example 6 with IfsaException

use of nl.nn.adapterframework.extensions.ifsa.IfsaException in project iaf by ibissource.

the class IfsaFacade method getMessagingSource.

protected IfsaMessagingSource getMessagingSource() throws IfsaException {
    if (messagingSource == null) {
        synchronized (this) {
            if (messagingSource == null) {
                log.debug(getLogPrefix() + "instantiating IfsaConnectionFactory");
                IfsaMessagingSourceFactory ifsaConnectionFactory = new IfsaMessagingSourceFactory();
                try {
                    log.debug(getLogPrefix() + "creating IfsaConnection");
                    messagingSource = (IfsaMessagingSource) ifsaConnectionFactory.getConnection(getApplicationId());
                } catch (IbisException e) {
                    if (e instanceof IfsaException) {
                        throw (IfsaException) e;
                    }
                    throw new IfsaException(e);
                }
            }
        }
    }
    return messagingSource;
}
Also used : IfsaException(nl.nn.adapterframework.extensions.ifsa.IfsaException) IbisException(nl.nn.adapterframework.core.IbisException)

Example 7 with IfsaException

use of nl.nn.adapterframework.extensions.ifsa.IfsaException in project iaf by ibissource.

the class IfsaFacade method closeService.

/**
 * Stops communication on the IFSA bus.
 * Releases references to serviceQueue and connection.
 */
public void closeService() throws IfsaException {
    try {
        if (messagingSource != null) {
            try {
                messagingSource.close();
            } catch (IbisException e) {
                if (e instanceof IfsaException) {
                    throw (IfsaException) e;
                }
                throw new IfsaException(e);
            }
            log.debug(getLogPrefix() + "closed connection for service");
        }
    } finally {
        // make sure all objects are reset, to be able to restart after IFSA parameters have changed (e.g. at iterative installation time)
        queue = null;
        messagingSource = null;
    }
}
Also used : IfsaException(nl.nn.adapterframework.extensions.ifsa.IfsaException) IbisException(nl.nn.adapterframework.core.IbisException)

Example 8 with IfsaException

use of nl.nn.adapterframework.extensions.ifsa.IfsaException in project iaf by ibissource.

the class IfsaFacade method sendReply.

/**
 * Intended for server-side reponse sending and implies that the received
 * message *always* contains a reply-to address.
 */
public void sendReply(QueueSession session, Message received_message, String response) throws IfsaException {
    QueueSender tqs = null;
    try {
        TextMessage answer = session.createTextMessage();
        answer.setText(response);
        Queue replyQueue = (Queue) received_message.getJMSReplyTo();
        tqs = session.createSender(replyQueue);
        if (log.isDebugEnabled())
            log.debug(getLogPrefix() + "sending reply to [" + received_message.getJMSReplyTo() + "]");
        ((IFSAServerQueueSender) tqs).sendReply(received_message, answer);
    } catch (Throwable t) {
        throw new IfsaException(t);
    } finally {
        if (tqs != null) {
            try {
                tqs.close();
            } catch (JMSException e) {
                log.warn(getLogPrefix() + "exception closing reply queue sender", e);
            }
        }
    }
}
Also used : IfsaException(nl.nn.adapterframework.extensions.ifsa.IfsaException) IFSAServerQueueSender(com.ing.ifsa.IFSAServerQueueSender) IFSAQueueSender(com.ing.ifsa.IFSAQueueSender) QueueSender(javax.jms.QueueSender) JMSException(javax.jms.JMSException) IFSAServerQueueSender(com.ing.ifsa.IFSAServerQueueSender) IFSAQueue(com.ing.ifsa.IFSAQueue) Queue(javax.jms.Queue) IFSATextMessage(com.ing.ifsa.IFSATextMessage) TextMessage(javax.jms.TextMessage)

Example 9 with IfsaException

use of nl.nn.adapterframework.extensions.ifsa.IfsaException in project iaf by ibissource.

the class IfsaMessagingSource method closeReplyReceiver.

public void closeReplyReceiver(QueueReceiver receiver) throws IfsaException {
    try {
        if (receiver != null) {
            Queue replyQueue = receiver.getQueue();
            receiver.close();
            releaseClientReplyQueue(replyQueue);
        }
    } catch (JMSException e) {
        throw new IfsaException(e);
    }
}
Also used : IfsaException(nl.nn.adapterframework.extensions.ifsa.IfsaException) JMSException(javax.jms.JMSException) Queue(javax.jms.Queue) IFSAQueue(com.ing.ifsa.IFSAQueue)

Example 10 with IfsaException

use of nl.nn.adapterframework.extensions.ifsa.IfsaException in project iaf by ibissource.

the class IfsaMessagingSource method getClientReplyQueue.

/**
 * Retrieves the reply queue for a <b>client</b> connection. If the
 * client is transactional the replyqueue is retrieved from IFSA,
 * otherwise a temporary (dynamic) queue is created.
 */
public Queue getClientReplyQueue(QueueSession session) throws IfsaException {
    Queue replyQueue = null;
    try {
        /*
			 * if we don't know if we're using a dynamic reply queue, we can
			 * check this using the function IsClientTransactional
			 * Yes -> we're using a static reply queue
			 * No -> dynamic reply queue
			 */
        if (hasDynamicReplyQueue()) {
            // Temporary Dynamic
            replyQueue = getDynamicReplyQueue(session);
            log.debug("got dynamic reply queue [" + replyQueue.getQueueName() + "]");
        } else {
            // Static
            replyQueue = (Queue) ((IFSAContext) getContext()).lookupReply(getId());
            log.debug("got static reply queue [" + replyQueue.getQueueName() + "]");
        }
        return replyQueue;
    } catch (Exception e) {
        throw new IfsaException(e);
    }
}
Also used : IfsaException(nl.nn.adapterframework.extensions.ifsa.IfsaException) IFSAContext(com.ing.ifsa.IFSAContext) Queue(javax.jms.Queue) IFSAQueue(com.ing.ifsa.IFSAQueue) NamingException(javax.naming.NamingException) JMSException(javax.jms.JMSException) IfsaException(nl.nn.adapterframework.extensions.ifsa.IfsaException)

Aggregations

IfsaException (nl.nn.adapterframework.extensions.ifsa.IfsaException)14 JMSException (javax.jms.JMSException)9 IFSAQueue (com.ing.ifsa.IFSAQueue)6 Queue (javax.jms.Queue)5 TextMessage (javax.jms.TextMessage)5 Message (javax.jms.Message)4 QueueSession (javax.jms.QueueSession)4 ListenerException (nl.nn.adapterframework.core.ListenerException)4 IFSAMessage (com.ing.ifsa.IFSAMessage)3 IFSATextMessage (com.ing.ifsa.IFSATextMessage)3 Map (java.util.Map)3 QueueReceiver (javax.jms.QueueReceiver)3 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)3 IbisException (nl.nn.adapterframework.core.IbisException)3 IFSAPoisonMessage (com.ing.ifsa.IFSAPoisonMessage)2 IFSAReportMessage (com.ing.ifsa.IFSAReportMessage)2 IFSATimeOutMessage (com.ing.ifsa.IFSATimeOutMessage)2 HashMap (java.util.HashMap)2 QueueSender (javax.jms.QueueSender)2 SenderException (nl.nn.adapterframework.core.SenderException)2