Search in sources :

Example 1 with IFSAContext

use of com.ing.ifsa.IFSAContext 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)

Example 2 with IFSAContext

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

the class IfsaMessagingSourceFactory method createMessagingSource.

protected MessagingSource createMessagingSource(String id, String authAlias, boolean createDestination, boolean useJms102) throws IbisException {
    IFSAContext context = (IFSAContext) getContext();
    IFSAQueueConnectionFactory connectionFactory = (IFSAQueueConnectionFactory) getConnectionFactory(context, id, createDestination, useJms102);
    return new IfsaMessagingSource(id, context, connectionFactory, getMessagingSourceMap(), preJms22Api, xaEnabled);
}
Also used : IFSAQueueConnectionFactory(com.ing.ifsa.IFSAQueueConnectionFactory) IFSAContext(com.ing.ifsa.IFSAContext)

Example 3 with IFSAContext

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

the class IfsaMessagingSourceFactory method createContext.

protected Context createContext() throws NamingException {
    log.info("IFSA API installed version [" + IFSAConstants.getVersionInfo() + "]");
    Hashtable env = new Hashtable(11);
    env.put(Context.INITIAL_CONTEXT_FACTORY, IFSA_INITIAL_CONTEXT_FACTORY);
    env.put(Context.PROVIDER_URL, getProviderUrl());
    // Create context as required by IFSA 2.0. Ignore the possible deprecation....
    return new IFSAContext((Context) new InitialContext(env));
}
Also used : Hashtable(java.util.Hashtable) IFSAContext(com.ing.ifsa.IFSAContext) InitialContext(javax.naming.InitialContext)

Example 4 with IFSAContext

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

the class IfsaMessagingSourceFactory method createConnectionFactory.

protected ConnectionFactory createConnectionFactory(Context context, String applicationId, boolean createDestination, boolean useJms102) throws IbisException, NamingException {
    IFSAQueueConnectionFactory ifsaQueueConnectionFactory = (IFSAQueueConnectionFactory) ((IFSAContext) context).lookupBusConnection(applicationId);
    if (log.isDebugEnabled()) {
        log.debug("IfsaConnection for application [" + applicationId + "] got ifsaQueueConnectionFactory with properties:" + ToStringBuilder.reflectionToString(ifsaQueueConnectionFactory) + "\n" + " isServer: " + ifsaQueueConnectionFactory.IsServer() + "\n" + " isClientNonTransactional:" + ifsaQueueConnectionFactory.IsClientNonTransactional() + "\n" + " isClientTransactional:" + ifsaQueueConnectionFactory.IsClientTransactional() + "\n" + " isClientServerNonTransactional:" + ifsaQueueConnectionFactory.IsClientServerNonTransactional() + "\n" + " isServerTransactional:" + ifsaQueueConnectionFactory.IsClientServerTransactional() + "\n");
    }
    if (!preJms22Api) {
        try {
            IFSAGate gate = IFSAGate.getInstance();
            xaEnabled = gate.isXA();
            log.info("IFSA JMS XA enabled [" + xaEnabled + "]");
            log.info("IFSA JMS hasDynamicReplyQueue: " + ((IFSAContext) context).hasDynamicReplyQueue());
        } catch (Throwable t) {
            log.info("caught exception determining IfsaJms v2.2+ features:", t);
        }
    } else {
        log.info("for IFSA JMS versions prior to 2.2 capability of XA support cannot be determined");
    }
    return ifsaQueueConnectionFactory;
}
Also used : IFSAQueueConnectionFactory(com.ing.ifsa.IFSAQueueConnectionFactory) IFSAGate(com.ing.ifsa.IFSAGate) IFSAContext(com.ing.ifsa.IFSAContext)

Aggregations

IFSAContext (com.ing.ifsa.IFSAContext)4 IFSAQueueConnectionFactory (com.ing.ifsa.IFSAQueueConnectionFactory)2 IFSAGate (com.ing.ifsa.IFSAGate)1 IFSAQueue (com.ing.ifsa.IFSAQueue)1 Hashtable (java.util.Hashtable)1 JMSException (javax.jms.JMSException)1 Queue (javax.jms.Queue)1 InitialContext (javax.naming.InitialContext)1 NamingException (javax.naming.NamingException)1 IfsaException (nl.nn.adapterframework.extensions.ifsa.IfsaException)1