Examples of AQjmsSession


Examples of oracle.jms.AQjmsSession

        // lookup and cache the queues
        QueueConnectionFactory queueFactory;
        QueueConnection queueConnection = null;
        TopicConnectionFactory topicFactory;
        TopicConnection topicConnection = null;
        AQjmsSession session = null;
        try {
            // create a datasource to use - datasources can keep the
            // username/password for later use
            DataSource ds = null;
            XADataSource xaDs = null;
            try {
                if (aqConnectionUrl != null)
                {
                    ds = AQUtil.getSQLDataSource(aqConnectionUrl, dbuser, dbpass);
                    xaDs = AQUtil.getXASQLDataSource(aqConnectionUrl, dbuser, dbpass);
                }
                else
                {
                    ds = AQUtil.getSQLDataSource( aqServerName, aqServerDBInst, aqServerPortNumber, aqDBDriver, dbuser, dbpass);
                    xaDs = AQUtil.getXASQLDataSource(aqServerName, aqServerDBInst, aqServerPortNumber, aqDBDriver, dbuser, dbpass);
                }
            } catch (SQLException e) {
                throw new RuntimeException(e.getMessage());
            }

            XAConnectionFactory factory = AQjmsFactory.getXAConnectionFactory(xaDs);
            context.rebind(XA_CONNECTION_FACTORY, factory);
            context.rebind("KURTSTAM", new String("hello"));

            // create the connection factory
            ConnectionFactory connectionFactory = AQjmsFactory.getConnectionFactory(ds);
            context.rebind(CONNECTION_FACTORY, connectionFactory);

            // create the queue connection factory
            queueFactory = AQjmsFactory.getQueueConnectionFactory(ds);
            context.rebind(QUEUE_CONNECTION_FACTORY, queueFactory);
            queueConnection = queueFactory.createQueueConnection();
            session = (AQjmsSession) queueConnection.createQueueSession(false,
                    Session.AUTO_ACKNOWLEDGE);

            // create the queue XA connection factory
            XAQueueConnectionFactory xaQueueConnectionFactory = AQjmsFactory.getXAQueueConnectionFactory(xaDs);
            context.rebind(XA_QUEUE_CONNECTION_FACTORY, xaQueueConnectionFactory);

//          create the topic XA connection factory
            XATopicConnectionFactory xaTopicConnectionFactory = AQjmsFactory.getXATopicConnectionFactory(xaDs);
            context.rebind(XA_TOPIC_CONNECTION_FACTORY, xaTopicConnectionFactory);

            // create the topic connection factory
            topicFactory = AQjmsFactory.getTopicConnectionFactory(ds);
            context.rebind(TOPIC_CONNECTION_FACTORY, topicFactory);
            topicConnection = topicFactory.createTopicConnection();
            session = (AQjmsSession) topicConnection.createTopicSession(false,
                    Session.AUTO_ACKNOWLEDGE);
            List<DestinationInfo> list = AQUtil.getDestinationInfoList(ds, aqSchemaName);
            // for each queue
            Iterator<DestinationInfo> iter = list.iterator();
            while (iter.hasNext()) {
                DestinationInfo di = iter.next();
                if(log.isDebugEnabled()) log.debug("Loading Destination: " + di);
                // register normal queue
                registerDestination(context, session, di);
            }
        } catch (JMSException e) {
            log.error("JMSException exception", e);
            throw new RuntimeException("JMSException exception", e);
        } finally {
            try {
                if (session != null)
                    session.close();
                if (queueConnection != null)
                    queueConnection.close();
                if (topicConnection != null)
                    topicConnection.close();
            } catch (JMSException e) {
View Full Code Here

Examples of oracle.jms.AQjmsSession

            throws JMSException {
        AQSession aqSession = null;
        AQQueue aqQueue = null;
        if (hermes.getSession() != null) {
            try {
                AQjmsSession aqjmsSession = (AQjmsSession) hermes.getSession();
                Class.forName(AQ_DRIVER_CLASS);
                Connection conn = aqjmsSession.getDBConnection();
                aqSession = AQDriverManager.createAQSession(conn);
                aqQueue = aqSession.getQueue(conn.getMetaData().getUserName(),
                        dConfig.getName());
                AQAgent[] aqAgents = aqQueue.getSubscribers();
                String clientId = dConfig.getClientID();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.