Package javax.jms

Examples of javax.jms.TopicConnection.start()


                conn = factory.createTopicConnection();
            }
            final TopicSession sess = conn.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
            final Topic topic = (Topic) lookup(context, queueBindingName);
            final TopicPublisher publisher = sess.createPublisher(topic);
            conn.start();
            return new TopicInfo(conn, sess, publisher);
        } catch (final NamingException ex) {
            LOGGER.warn("Unable to locate connection factory " + factoryBindingName, ex);
            if (!suppress) {
                throw ex;
View Full Code Here


        try {
            final Context ctx = new InitialContext();
            TopicConnectionFactory topicConnectionFactory;
            topicConnectionFactory = (TopicConnectionFactory) lookup(ctx, tcfBindingName);
            final TopicConnection topicConnection = topicConnectionFactory.createTopicConnection(username, password);
            topicConnection.start();
            final TopicSession topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
            final Topic topic = (Topic) ctx.lookup(topicBindingName);
            final TopicSubscriber topicSubscriber = topicSession.createSubscriber(topic);
            topicSubscriber.setMessageListener(this);
        } catch (final JMSException e) {
View Full Code Here

      Message m = sub2.receive(200);

      ProxyAssertSupport.assertNull(m);

      conn2.start();

      for (int i = 0; i < NUM_MESSAGES; i++)
      {
         TextMessage tm = (TextMessage)sub2.receive(500);
         ProxyAssertSupport.assertNotNull(tm);
View Full Code Here

      try
      {
         TopicSession s = conn.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
         TopicPublisher publisher = s.createPublisher(HornetQServerTestCase.topic1);
         TopicSubscriber sub = s.createSubscriber(HornetQServerTestCase.topic1);
         conn.start();

         // Create 3 object messages with different bodies

         TestObject to1 = new TestObject();
         to1.text = "hello1";
View Full Code Here

    //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);
View Full Code Here

  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);
View Full Code Here

      Message m = sub2.receive(200);
     
      assertNull(m);
     
      conn2.start();
     
      count = 0;
      while (true)
      {
         TextMessage tm = (TextMessage)sub2.receive(200);
View Full Code Here

        
         //Give them a little time
         Thread.sleep(3000);
        
         // Start the connection for delivery
         conn.start();
  
         // There should be 1 subscription
         ObjectName destObjectName =
            new ObjectName("jboss.messaging.destination:service=Topic,name=TopicMessageList");
        
View Full Code Here

         int count = ((Integer)ServerManagement.getAttribute(destObjectName, "AllMessageCount")).intValue();
        
         assertEquals(2, count);
        
         // Start the connection for delivery
         conn.start();
        
         // Remove all messages from the topic
        
         //Need to pause since delivery may still be in progress
         Thread.sleep(2000);
View Full Code Here

         count = ((Integer)ServerManagement.getAttribute(destObjectName, "AllMessageCount")).intValue();
        
         assertEquals(1, count);

         // Start the connection for delivery
         conn.start();
        
         conn.close();
        
         // Remove all messages from the topic
         ServerManagement.invoke(destObjectName, "removeAllMessages", null, null);
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.