javax.jms.XAQueueConnectionFactory Java Examples

The following examples show how to use javax.jms.XAQueueConnectionFactory. 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 5 votes vote down vote up
private void assertNTypes(ActiveMQConnectionFactory factory, final int total) {
   StringBuilder text = new StringBuilder();
   text.append(factory + "\n is instance of ");
   int num = 0;
   if (factory instanceof ConnectionFactory) {
      num++;
      text.append("ConnectionFactory ");
   }
   if (factory instanceof XAConnectionFactory) {
      num++;
      text.append("XAConnectionFactory ");
   }
   if (factory instanceof QueueConnectionFactory) {
      num++;
      text.append("QueueConnectionFactory ");
   }
   if (factory instanceof TopicConnectionFactory) {
      num++;
      text.append("TopicConnectionFactory ");
   }
   if (factory instanceof XAQueueConnectionFactory) {
      num++;
      text.append("XAQueueConnectionFactory ");
   }
   if (factory instanceof XATopicConnectionFactory) {
      num++;
      text.append("XATopicConnectionFactory ");
   }
   Assert.assertEquals(text.toString(), total, num);
}
 
Example #2
Source File: TracingConnectionFactory.java    From brave with Apache License 2.0 5 votes vote down vote up
TracingConnectionFactory(Object delegate, JmsTracing jmsTracing) {
  this.delegate = delegate;
  this.jmsTracing = jmsTracing;
  int types = 0;
  if (delegate instanceof ConnectionFactory) types |= TYPE_CF;
  if (delegate instanceof QueueConnectionFactory) types |= TYPE_QUEUE_CF;
  if (delegate instanceof TopicConnectionFactory) types |= TYPE_TOPIC_CF;
  if (delegate instanceof XAConnectionFactory) types |= TYPE_XA_CF;
  if (delegate instanceof XAQueueConnectionFactory) types |= TYPE_XA_QUEUE_CF;
  if (delegate instanceof XATopicConnectionFactory) types |= TYPE_XA_TOPIC_CF;
  this.types = types;
}
 
Example #3
Source File: TracingXAConnectionFactory.java    From brave with Apache License 2.0 5 votes vote down vote up
@Override public XAQueueConnection createXAQueueConnection(String userName, String password)
  throws JMSException {
  checkQueueConnectionFactory();
  XAQueueConnectionFactory xaqcf = (XAQueueConnectionFactory) delegate;
  return TracingXAConnection.create(xaqcf.createXAQueueConnection(userName, password),
    jmsTracing);
}
 
Example #4
Source File: ConnectionFactoryTest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@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 #5
Source File: TracingXAConnectionFactory.java    From brave with Apache License 2.0 4 votes vote down vote up
@Override public XAQueueConnection createXAQueueConnection() throws JMSException {
  checkQueueConnectionFactory();
  XAQueueConnectionFactory xaqcf = (XAQueueConnectionFactory) delegate;
  return TracingXAConnection.create(xaqcf.createXAQueueConnection(), jmsTracing);
}