Examples of TopicConnection


Examples of javax.jms.TopicConnection

      Connection consumerConnection = null;

      try
      {
         consumerConnection = JMSTestCase.cf.createConnection();
         TopicConnection tc = (TopicConnection)consumerConnection;

         TopicSession consumerSession = tc.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);

         TopicSubscriber topicConsumer = consumerSession.createSubscriber(HornetQServerTestCase.topic1);

         topicConsumer.close();
View Full Code Here

Examples of javax.jms.TopicConnection

    * created.
    */
   public void testTopicConnectionFactory() throws Exception
   {
      TopicConnectionFactory qcf = (TopicConnectionFactory)JMSTestCase.ic.lookup("/CF_TOPIC_XA_FALSE");
      TopicConnection tc = qcf.createTopicConnection();
      tc.close();
   }
View Full Code Here

Examples of javax.jms.TopicConnection

   public void testConnectionTypes() throws Exception
   {
      Connection genericConnection = null;
      XAConnection xaConnection = null;
      QueueConnection queueConnection = null;
      TopicConnection topicConnection = null;
      XAQueueConnection xaQueueConnection = null;
      XATopicConnection xaTopicConnection = null;

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

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

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

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

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

      XATopicConnectionFactory xaTopicCF = (XATopicConnectionFactory)JMSTestCase.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();
   }
View Full Code Here

Examples of javax.jms.TopicConnection

    */
   public void testQueueConnection2() throws Exception
   {
      TopicConnectionFactory tcf = JMSTestCase.topicCf;

      TopicConnection tc = tcf.createTopicConnection();

      tc.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);

      tc.close();

   }
View Full Code Here

Examples of javax.jms.TopicConnection

   /**
    * Test introduced as a result of a TCK failure.
    */
   public void testNonDurableSubscriberOnNullTopic() throws Exception
   {
      TopicConnection conn = null;

      try
      {
         conn = JMSTestCase.cf.createTopicConnection();

         TopicSession ts = conn.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);

         try
         {
            ts.createSubscriber(null);
            ProxyAssertSupport.fail("this should fail");
         }
         catch (javax.jms.InvalidDestinationException e)
         {
            // OK
         }
      }
      finally
      {
         if (conn != null)
         {
            conn.close();
         }
      }
   }
View Full Code Here

Examples of javax.jms.TopicConnection

   /**
    * Test introduced as a result of a TCK failure.
    */
   public void testNonDurableSubscriberInvalidUnsubscribe() throws Exception
   {
      TopicConnection conn = null;

      try
      {
         conn = JMSTestCase.cf.createTopicConnection();
         conn.setClientID("sofiavergara");

         TopicSession ts = conn.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);

         try
         {
            ts.unsubscribe("invalid-subscription-name");
            ProxyAssertSupport.fail("this should fail");
         }
         catch (javax.jms.InvalidDestinationException e)
         {
            // OK
         }
      }
      finally
      {
         if (conn != null)
         {
            conn.close();
         }
      }
   }
View Full Code Here

Examples of javax.jms.TopicConnection

      }
   }

   public void testInvalidSelectorOnSubscription() throws Exception
   {
      TopicConnection c = null;
      try
      {
         c = JMSTestCase.cf.createTopicConnection();
         c.setClientID("something");

         TopicSession s = c.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);

         try
         {
            s.createSubscriber(HornetQServerTestCase.topic1, "=TEST 'test'", false);
            ProxyAssertSupport.fail("this should fail");
         }
         catch (InvalidSelectorException e)
         {
            // OK
         }
      }
      finally
      {
         c.close();
      }
   }
View Full Code Here

Examples of javax.jms.TopicConnection

    //the timer is created when the
    public void sendMessage() throws Exception {
        final InitialContext ctx = new InitialContext();
        final TopicConnectionFactory factory = (TopicConnectionFactory) ctx.lookup("java:/JmsXA");
        final TopicConnection connection = factory.createTopicConnection();
        connection.start();
        try {
            final TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
            final Message message = session.createTextMessage("Test");
            final Destination destination = (Destination) ctx.lookup("topic/test");
            final MessageProducer producer = session.createProducer(destination);
            producer.send(message);
            producer.close();
View Full Code Here

Examples of javax.jms.TopicConnection

  @Override
  public boolean sendEmail(final Email email) {

    try {
      final TopicConnection connection = topicFactory.createTopicConnection();

      connection.start();

      final TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);

      final TopicPublisher publisher = session.createPublisher(topic);

      final MapMessage message = session.createMapMessage();

      message.setString("nome", "Regis");
      message.setInt("idade", 23);

      publisher.send(message);

      // close resources
      publisher.close();
      session.close();
      connection.close();
    } catch (JMSException e) {
      log.error("", e);
    } catch (Exception e) {
      log.error("", e);
    }
View Full Code Here

Examples of javax.jms.TopicConnection

    */
   public void testQueueConnection2() throws Exception
   {
      TopicConnectionFactory tcf = (TopicConnectionFactory)cf;

      TopicConnection tc = tcf.createTopicConnection();

      tc.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);

      tc.close();

   }
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.