javax.jms.XAQueueConnection Java Examples
The following examples show how to use
javax.jms.XAQueueConnection.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConnectionFactoryTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
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); } }
Example #2
Source File: ActiveMQRAConnectionFactoryImpl.java From activemq-artemis with Apache License 2.0 | 6 votes |
/** * 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 (ActiveMQRALogger.LOGGER.isTraceEnabled()) { 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 (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Created queue connection: " + s); } return s; }
Example #3
Source File: ManagedConnection.java From ats-framework with Apache License 2.0 | 6 votes |
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); } }
Example #4
Source File: OutgoingConnectionTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@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)); }
Example #5
Source File: JmsTracingTest.java From brave with Apache License 2.0 | 5 votes |
@Test public void queueConnection_wrapsXaInput() { abstract class Both implements XAQueueConnection, QueueConnection { } assertThat(jmsTracing.queueConnection(mock(Both.class))) .isInstanceOf(XAQueueConnection.class); }
Example #6
Source File: TracingConnection.java From brave with Apache License 2.0 | 5 votes |
TracingConnection(Connection delegate, JmsTracing jmsTracing) { this.delegate = delegate; this.jmsTracing = jmsTracing; int types = 0; if (delegate instanceof QueueConnection) types |= TYPE_QUEUE; if (delegate instanceof TopicConnection) types |= TYPE_TOPIC; if (delegate instanceof XAConnection) types |= TYPE_XA; if (delegate instanceof XAQueueConnection) types |= TYPE_XA_QUEUE; if (delegate instanceof XATopicConnection) types |= TYPE_XA_TOPIC; this.types = types; }
Example #7
Source File: ActiveMQRAConnectionFactoryImpl.java From activemq-artemis with Apache License 2.0 | 5 votes |
/** * Create a XA queue connection * * @return The connection * @throws JMSException Thrown if the operation fails */ @Override public XAQueueConnection createXAQueueConnection() throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("createXAQueueConnection()"); } ActiveMQRASessionFactoryImpl s = new ActiveMQRASessionFactoryImpl(mcf, cm, getResourceAdapter().getTM(), ActiveMQRAConnectionFactory.XA_QUEUE_CONNECTION); if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Created queue connection: " + s); } return s; }
Example #8
Source File: TracingXAConnectionFactory.java From brave with Apache License 2.0 | 5 votes |
@Override public XAQueueConnection createXAQueueConnection(String userName, String password) throws JMSException { checkQueueConnectionFactory(); XAQueueConnectionFactory xaqcf = (XAQueueConnectionFactory) delegate; return TracingXAConnection.create(xaqcf.createXAQueueConnection(userName, password), jmsTracing); }
Example #9
Source File: TracingXAConnection.java From brave with Apache License 2.0 | 5 votes |
@Override public XAQueueSession createXAQueueSession() throws JMSException { if ((types & TYPE_XA_QUEUE) != TYPE_XA_QUEUE) { throw new IllegalStateException(delegate + " is not an XAQueueConnection"); } XAQueueSession xats = ((XAQueueConnection) delegate).createXAQueueSession(); return TracingXASession.create(xats, jmsTracing); }
Example #10
Source File: JmsTracing.java From brave with Apache License 2.0 | 5 votes |
public QueueConnection queueConnection(QueueConnection connection) { // It is common to implement both interfaces if (connection instanceof XAQueueConnection) { return xaQueueConnection((XAQueueConnection) connection); } return TracingConnection.create(connection, this); }
Example #11
Source File: ActiveMQConnectionFactory.java From activemq-artemis with Apache License 2.0 | 4 votes |
public XAQueueConnection createXAQueueConnection(final String username, final String password) throws JMSException { return (XAQueueConnection) createConnectionInternal(username, password, true, ActiveMQConnection.TYPE_QUEUE_CONNECTION); }
Example #12
Source File: JmsTracingTest.java From brave with Apache License 2.0 | 4 votes |
@Test public void xaQueueConnection_doesntDoubleWrap() { XAQueueConnection wrapped = jmsTracing.xaQueueConnection(mock(XAQueueConnection.class)); assertThat(jmsTracing.xaQueueConnection(wrapped)) .isSameAs(wrapped); }
Example #13
Source File: JmsTracingTest.java From brave with Apache License 2.0 | 4 votes |
@Test public void xaQueueConnection_wrapsInput() { assertThat(jmsTracing.xaQueueConnection(mock(XAQueueConnection.class))) .isInstanceOf(TracingXAConnection.class); }
Example #14
Source File: TracingXAConnectionFactory.java From brave with Apache License 2.0 | 4 votes |
@Override public XAQueueConnection createXAQueueConnection() throws JMSException { checkQueueConnectionFactory(); XAQueueConnectionFactory xaqcf = (XAQueueConnectionFactory) delegate; return TracingXAConnection.create(xaqcf.createXAQueueConnection(), jmsTracing); }
Example #15
Source File: JmsTracing.java From brave with Apache License 2.0 | 4 votes |
public XAQueueConnection xaQueueConnection(XAQueueConnection connection) { return TracingXAConnection.create(connection, this); }
Example #16
Source File: ActiveMQConnectionFactory.java From activemq-artemis with Apache License 2.0 | 4 votes |
public XAQueueConnection createXAQueueConnection() throws JMSException { return createXAQueueConnection(user, password); }
Example #17
Source File: ConnectionFactoryTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
@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"); }
Example #18
Source File: ActiveMQXAConnectionFactoryTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
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); }
Example #19
Source File: ManagedXAQueueTopicConnection.java From ats-framework with Apache License 2.0 | 4 votes |
@Override public XAQueueSession createXAQueueSession() throws JMSException { return addSession( ((XAQueueConnection) connection).createXAQueueSession()); }
Example #20
Source File: ManagedXAQueueConnection.java From ats-framework with Apache License 2.0 | 4 votes |
public ManagedXAQueueConnection( XAQueueConnection connection ) { super(connection); this.xaConnection = connection; }