本文整理汇总了Java中javax.jms.XAQueueConnection类的典型用法代码示例。如果您正苦于以下问题:Java XAQueueConnection类的具体用法?Java XAQueueConnection怎么用?Java XAQueueConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XAQueueConnection类属于javax.jms包,在下文中一共展示了XAQueueConnection类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: create
import javax.jms.XAQueueConnection; //导入依赖的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
import javax.jms.XAQueueConnection; //导入依赖的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
import javax.jms.XAQueueConnection; //导入依赖的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: createXAQueueConnection
import javax.jms.XAQueueConnection; //导入依赖的package包/类
/**
* Create a XA queue connection
*
* @param userName The user name
* @param password The password
* @return The connection
* @throws JMSException Thrown if the operation fails
*/
@Override
public XAQueueConnection createXAQueueConnection(final String userName, final String password) throws JMSException {
if (ActiveMQRAConnectionFactoryImpl.trace) {
ActiveMQRALogger.LOGGER.trace("createXAQueueConnection(" + userName + ", ****)");
}
ActiveMQRASessionFactoryImpl s = new ActiveMQRASessionFactoryImpl(mcf, cm, getResourceAdapter().getTM(), ActiveMQRAConnectionFactory.XA_QUEUE_CONNECTION);
s.setUserName(userName);
s.setPassword(password);
validateUser(s);
if (ActiveMQRAConnectionFactoryImpl.trace) {
ActiveMQRALogger.LOGGER.trace("Created queue connection: " + s);
}
return s;
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:26,代码来源:ActiveMQRAConnectionFactoryImpl.java
示例5: testSimpleMessageSendAndReceiveXA
import javax.jms.XAQueueConnection; //导入依赖的package包/类
@Test
public void testSimpleMessageSendAndReceiveXA() throws Exception {
Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
XAQueueConnection queueConnection = qraConnectionFactory.createXAQueueConnection();
XASession s = queueConnection.createXASession();
XAResource resource = s.getXAResource();
resource.start(xid, XAResource.TMNOFLAGS);
Queue q = ActiveMQJMSClient.createQueue(MDBQUEUE);
MessageProducer mp = s.createProducer(q);
MessageConsumer consumer = s.createConsumer(q);
Message message = s.createTextMessage("test");
mp.send(message);
queueConnection.start();
TextMessage textMessage = (TextMessage) consumer.receiveNoWait();
assertNull(textMessage);
resource.end(xid, XAResource.TMSUCCESS);
resource.commit(xid, true);
resource.start(xid, XAResource.TMNOFLAGS);
textMessage = (TextMessage) consumer.receiveNoWait();
resource.end(xid, XAResource.TMSUCCESS);
resource.commit(xid, true);
assertNotNull(textMessage);
assertEquals(textMessage.getText(), "test");
// When I wrote this call, this method was doing an infinite loop.
// this is just to avoid such thing again
textMessage.getJMSDeliveryTime();
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:31,代码来源:OutgoingConnectionTest.java
示例6: testOutgoingXAResourceWrapper
import javax.jms.XAQueueConnection; //导入依赖的package包/类
@Test
public void testOutgoingXAResourceWrapper() throws Exception {
XAQueueConnection queueConnection = qraConnectionFactory.createXAQueueConnection();
XASession s = queueConnection.createXASession();
XAResource resource = s.getXAResource();
assertTrue(resource instanceof ActiveMQXAResourceWrapper);
ActiveMQXAResourceWrapperImpl xaResourceWrapper = (ActiveMQXAResourceWrapperImpl) resource;
assertTrue(xaResourceWrapper.getJndiName().equals("java://jmsXA NodeId:" + server.getNodeID()));
assertTrue(xaResourceWrapper.getProductVersion().equals(VersionLoader.getVersion().getFullVersion()));
assertTrue(xaResourceWrapper.getProductName().equals(ActiveMQResourceAdapter.PRODUCT_NAME));
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:14,代码来源:OutgoingConnectionTest.java
示例7: ManagedXAQueueConnection
import javax.jms.XAQueueConnection; //导入依赖的package包/类
public ManagedXAQueueConnection( XAQueueConnection connection ) {
super(connection);
this.xaConnection = connection;
}
开发者ID:Axway,项目名称:ats-framework,代码行数:6,代码来源:ManagedXAQueueConnection.java
示例8: createXAQueueSession
import javax.jms.XAQueueConnection; //导入依赖的package包/类
@Override
public XAQueueSession createXAQueueSession() throws JMSException {
return addSession( ((XAQueueConnection) connection).createXAQueueSession());
}
开发者ID:Axway,项目名称:ats-framework,代码行数:6,代码来源:ManagedXAQueueTopicConnection.java
示例9: createXAQueueConnection
import javax.jms.XAQueueConnection; //导入依赖的package包/类
public XAQueueConnection createXAQueueConnection() throws JMSException {
return (XAQueueConnection) createActiveMQConnection();
}
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:4,代码来源:ActiveMQXAConnectionFactory.java
示例10: assertXAConnection
import javax.jms.XAQueueConnection; //导入依赖的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
示例11: testConnectionTypes
import javax.jms.XAQueueConnection; //导入依赖的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
示例12: createXAQueueConnection
import javax.jms.XAQueueConnection; //导入依赖的package包/类
public XAQueueConnection createXAQueueConnection() throws JMSException {
return createXAQueueConnection(user, password);
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:4,代码来源:ActiveMQConnectionFactory.java
示例13: createXAQueueConnection
import javax.jms.XAQueueConnection; //导入依赖的package包/类
/**
* Creates a XAQueueConnection with the default user identity.
* <p> The XAQueueConnection is created in stopped mode. No messages
* will be delivered until the <code>Connection.start</code> method
* is explicitly called.
*
* @return A newly created XAQueueConnection
* @throws JMSException If creating the XAQueueConnection fails due to some internal error.
* @throws JMSSecurityException If client authentication fails due to an invalid user name or password.
*/
public XAQueueConnection createXAQueueConnection() throws JMSException
{
return (XAQueueConnection) createXAConnection();
}
开发者ID:wso2,项目名称:andes,代码行数:15,代码来源:AMQXAConnectionFactory.java
注:本文中的javax.jms.XAQueueConnection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论