• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java XATopicConnection类的典型用法和代码示例

java 3次浏览

本文整理汇总了Java中javax.jms.XATopicConnection的典型用法代码示例。如果您正苦于以下问题:Java XATopicConnection类的具体用法?Java XATopicConnection怎么用?Java XATopicConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

XATopicConnection类属于javax.jms包,在下文中一共展示了XATopicConnection类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: create

点赞 3

import javax.jms.XATopicConnection; //导入依赖的package包/类
public static ManagedConnection create(
                                        final Connection connection ) {

    if ( (connection instanceof XAQueueConnection) && (connection instanceof XATopicConnection)) {
        return new ManagedXAQueueTopicConnection(connection);
    } else if (connection instanceof XAQueueConnection) {
        return new ManagedXAQueueConnection((XAQueueConnection) connection);
    } else if (connection instanceof XATopicConnection) {
        return new ManagedXATopicConnection((XATopicConnection) connection);
    } else if ( (connection instanceof QueueConnection) && (connection instanceof TopicConnection)) {
        return new ManagedQueueTopicConnection(connection);
    } else if (connection instanceof QueueConnection) {
        return new ManagedQueueConnection((QueueConnection) connection);
    } else if (connection instanceof TopicConnection) {
        return new ManagedTopicConnection((TopicConnection) connection);
    } else {
        return new ManagedConnection(connection);
    }
}
 

开发者ID:Axway,
项目名称:ats-framework,
代码行数:20,
代码来源:ManagedConnection.java

示例2: createXASession

点赞 3

import javax.jms.XATopicConnection; //导入依赖的package包/类
/**
 * Create JMS {@link XASession} instance on top of the provided {@link Connection} instance.
 *
 * @param xAConnection JMS Connection.
 * @return Session instance.
 * @throws JMSConnectorException Error when creating the XASession.
 */
public XASession createXASession(XAConnection xAConnection) throws JMSConnectorException {
    try {
        if (logger.isDebugEnabled()) {
            logger.debug("Creating a new JMS XASession on: " + this.connectionFactoryString);
        }

        if (JMSConstants.JMS_SPEC_VERSION_1_1.equals(jmsSpec) || JMSConstants.JMS_SPEC_VERSION_2_0
                .equals(jmsSpec)) {
            return xAConnection.createXASession();
        } else if (JMSConstants.JMSDestinationType.QUEUE.equals(this.destinationType)) {
            return ((XAQueueConnection) (xAConnection)).createXAQueueSession();
        } else {
            return ((XATopicConnection) (xAConnection)).createXATopicSession();
        }
    } catch (JMSException e) {
        throw new JMSConnectorException(
                "JMS Exception while obtaining session for factory " + connectionFactoryString, e);
    }
}
 

开发者ID:wso2,
项目名称:carbon-transports,
代码行数:27,
代码来源:JMSConnectionResourceFactory.java

示例3: assertConnectionType

点赞 3

import javax.jms.XATopicConnection; //导入依赖的package包/类
private void assertConnectionType(Connection conn, String type) {
   if ("generic".equals(type) || "queue".equals(type) || "topic".equals(type)) {
      //generic
      Assert.assertFalse(conn instanceof XAConnection);
      Assert.assertTrue(conn instanceof QueueConnection);
      Assert.assertFalse(conn instanceof XAQueueConnection);
      Assert.assertTrue(conn instanceof TopicConnection);
      Assert.assertFalse(conn instanceof XATopicConnection);
   } else if ("xa".equals(type) || "xa-queue".equals(type) || "xa-topic".equals(type)) {
      Assert.assertTrue(conn instanceof XAConnection);
      Assert.assertTrue(conn instanceof QueueConnection);
      Assert.assertTrue(conn instanceof XAQueueConnection);
      Assert.assertTrue(conn instanceof TopicConnection);
      Assert.assertTrue(conn instanceof XATopicConnection);
   } else {
      Assert.fail("Unknown connection type: " + type);
   }
}
 

开发者ID:apache,
项目名称:activemq-artemis,
代码行数:19,
代码来源:ConnectionFactoryTest.java

示例4: createXATopicConnection

点赞 3

import javax.jms.XATopicConnection; //导入依赖的package包/类
/**
 * Create a XA topic connection
 *
 * @param userName The user name
 * @param password The password
 * @return The connection
 * @throws JMSException Thrown if the operation fails
 */
@Override
public XATopicConnection createXATopicConnection(final String userName, final String password) throws JMSException {
   if (ActiveMQRAConnectionFactoryImpl.trace) {
      ActiveMQRALogger.LOGGER.trace("createXATopicConnection(" + userName + ", ****)");
   }

   ActiveMQRASessionFactoryImpl s = new ActiveMQRASessionFactoryImpl(mcf, cm, getResourceAdapter().getTM(), ActiveMQRAConnectionFactory.XA_TOPIC_CONNECTION);
   s.setUserName(userName);
   s.setPassword(password);
   validateUser(s);

   if (ActiveMQRAConnectionFactoryImpl.trace) {
      ActiveMQRALogger.LOGGER.trace("Created topic connection: " + s);
   }

   return s;
}
 

开发者ID:apache,
项目名称:activemq-artemis,
代码行数:26,
代码来源:ActiveMQRAConnectionFactoryImpl.java

示例5: ManagedXATopicConnection

点赞 2

import javax.jms.XATopicConnection; //导入依赖的package包/类
public ManagedXATopicConnection( XATopicConnection connection ) {

        super(connection);
        this.xaTopicConnection = connection;
    }
 

开发者ID:Axway,
项目名称:ats-framework,
代码行数:6,
代码来源:ManagedXATopicConnection.java

示例6: createXATopicSession

点赞 2

import javax.jms.XATopicConnection; //导入依赖的package包/类
@Override
public XATopicSession createXATopicSession() throws JMSException {

    return addSession( ((XATopicConnection) connection).createXATopicSession());
}
 

开发者ID:Axway,
项目名称:ats-framework,
代码行数:6,
代码来源:ManagedXAQueueTopicConnection.java

示例7: createXATopicConnection

点赞 2

import javax.jms.XATopicConnection; //导入依赖的package包/类
public XATopicConnection createXATopicConnection() throws JMSException {
    return (XATopicConnection) createActiveMQConnection();
}
 

开发者ID:DiamondLightSource,
项目名称:daq-eclipse,
代码行数:4,
代码来源:ActiveMQXAConnectionFactory.java

示例8: assertXAConnection

点赞 2

import javax.jms.XATopicConnection; //导入依赖的package包/类
private void assertXAConnection(Connection connection) {
   assertTrue("Should be an XAConnection", connection instanceof XAConnection);
   assertTrue("Should be an XATopicConnection", connection instanceof XATopicConnection);
   assertTrue("Should be an XAQueueConnection", connection instanceof XAQueueConnection);
}
 

开发者ID:apache,
项目名称:activemq-artemis,
代码行数:6,
代码来源:ActiveMQXAConnectionFactoryTest.java

示例9: testConnectionTypes

点赞 2

import javax.jms.XATopicConnection; //导入依赖的package包/类
@Test
public void testConnectionTypes() throws Exception {
   deployConnectionFactory(0, JMSFactoryType.CF, "ConnectionFactory", "/ConnectionFactory");
   deployConnectionFactory(0, JMSFactoryType.QUEUE_XA_CF, "CF_QUEUE_XA_TRUE", "/CF_QUEUE_XA_TRUE");
   deployConnectionFactory(0, JMSFactoryType.XA_CF, "CF_XA_TRUE", "/CF_XA_TRUE");
   deployConnectionFactory(0, JMSFactoryType.QUEUE_CF, "CF_QUEUE", "/CF_QUEUE");
   deployConnectionFactory(0, JMSFactoryType.TOPIC_CF, "CF_TOPIC", "/CF_TOPIC");
   deployConnectionFactory(0, JMSFactoryType.TOPIC_XA_CF, "CF_TOPIC_XA_TRUE", "/CF_TOPIC_XA_TRUE");

   Connection genericConnection = null;
   XAConnection xaConnection = null;
   QueueConnection queueConnection = null;
   TopicConnection topicConnection = null;
   XAQueueConnection xaQueueConnection = null;
   XATopicConnection xaTopicConnection = null;

   ConnectionFactory genericFactory = (ConnectionFactory) ic.lookup("/ConnectionFactory");
   genericConnection = genericFactory.createConnection();
   assertConnectionType(genericConnection, "generic");

   XAConnectionFactory xaFactory = (XAConnectionFactory) ic.lookup("/CF_XA_TRUE");
   xaConnection = xaFactory.createXAConnection();
   assertConnectionType(xaConnection, "xa");

   QueueConnectionFactory queueCF = (QueueConnectionFactory) ic.lookup("/CF_QUEUE");
   queueConnection = queueCF.createQueueConnection();
   assertConnectionType(queueConnection, "queue");

   TopicConnectionFactory topicCF = (TopicConnectionFactory) ic.lookup("/CF_TOPIC");
   topicConnection = topicCF.createTopicConnection();
   assertConnectionType(topicConnection, "topic");

   XAQueueConnectionFactory xaQueueCF = (XAQueueConnectionFactory) ic.lookup("/CF_QUEUE_XA_TRUE");
   xaQueueConnection = xaQueueCF.createXAQueueConnection();
   assertConnectionType(xaQueueConnection, "xa-queue");

   XATopicConnectionFactory xaTopicCF = (XATopicConnectionFactory) ic.lookup("/CF_TOPIC_XA_TRUE");
   xaTopicConnection = xaTopicCF.createXATopicConnection();
   assertConnectionType(xaTopicConnection, "xa-topic");

   genericConnection.close();
   xaConnection.close();
   queueConnection.close();
   topicConnection.close();
   xaQueueConnection.close();
   xaTopicConnection.close();

   undeployConnectionFactory("ConnectionFactory");
   undeployConnectionFactory("CF_QUEUE_XA_TRUE");
   undeployConnectionFactory("CF_XA_TRUE");
   undeployConnectionFactory("CF_QUEUE");
   undeployConnectionFactory("CF_TOPIC");
   undeployConnectionFactory("CF_TOPIC_XA_TRUE");
}
 

开发者ID:apache,
项目名称:activemq-artemis,
代码行数:55,
代码来源:ConnectionFactoryTest.java

示例10: createXATopicConnection

点赞 2

import javax.jms.XATopicConnection; //导入依赖的package包/类
public XATopicConnection createXATopicConnection() throws JMSException {
   return createXATopicConnection(user, password);
}
 

开发者ID:apache,
项目名称:activemq-artemis,
代码行数:4,
代码来源:ActiveMQConnectionFactory.java

示例11: createXATopicConnection

点赞 1

import javax.jms.XATopicConnection; //导入依赖的package包/类
/**
 * Creates a XATopicConnection with the default user identity.
 * <p> The XATopicConnection is created in stopped mode. No messages
 * will be delivered until the <code>Connection.start</code> method
 * is explicitly called.
 *
 * @return A newly created XATopicConnection
 * @throws JMSException         If creating the XATopicConnection fails due to some internal error.
 * @throws JMSSecurityException If client authentication fails due to an invalid user name or password.
 */
public XATopicConnection createXATopicConnection() throws JMSException
{
    return (XATopicConnection) createXAConnection();
}
 

开发者ID:wso2,
项目名称:andes,
代码行数:15,
代码来源:AMQXAConnectionFactory.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)