Package org.hornetq.api.jms.management

Examples of org.hornetq.api.jms.management.TopicControl


      }

      Object[] topicControls = server.getHornetQServer().getManagementService().getResources(TopicControl.class);
      for (Object topicControl2 : topicControls)
      {
         TopicControl topicControl = (TopicControl)topicControl2;
         allDests.put(topicControl.getAddress(), topicControl);
      }

      List<String> destinations = new ArrayList<String>();
      for (String addresse : addresses)
      {
View Full Code Here


                                                                    .getResource(ResourceNames.JMS_QUEUE + destination);
         queue.removeMessages(null);
      }
      else
      {
         TopicControl topic = (TopicControl)getHornetQServer().getManagementService()
                                                              .getResource(ResourceNames.JMS_TOPIC + destination);
         topic.removeMessages(null);
      }
   }
View Full Code Here

   }

   public List<String> listAllSubscribersForTopic(final String s) throws Exception
   {
      ObjectName objectName = ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(s);
      TopicControl topic = (TopicControl)MBeanServerInvocationHandler.newProxyInstance(ManagementFactory.getPlatformMBeanServer(),
                                                                         objectName,
                                                                         TopicControl.class,
                                                                         false);
      Object[] subInfos = topic.listAllSubscriptions();
      List<String> subs = new ArrayList<String>();
      for (Object o : subInfos)
      {
         Object[] data = (Object[])o;
         subs.add((String)data[2]);
View Full Code Here

      {
         Object[] topicControls = server.getHornetQServer().getManagementService().getResources(TopicControl.class);
         String[] names = new String[topicControls.length];
         for (int i = 0; i < topicControls.length; i++)
         {
            TopicControl topicControl = (TopicControl)topicControls[i];
            names[i] = topicControl.getName();
         }
         return names;
      }
      finally
      {
View Full Code Here

      }

      Object[] topicControls = server.getHornetQServer().getManagementService().getResources(TopicControl.class);
      for (int i = 0; i < topicControls.length; i++)
      {
         TopicControl topicControl = (TopicControl)topicControls[i];
         allDests.put(topicControl.getAddress(), topicControl);
      }

      List<String> destinations = new ArrayList<String>();
      for (int i = 0; i < addresses.length; i++)
      {
View Full Code Here

  
   public void testSendTopicNoSubscription() throws Exception
   {
     
      Topic topic = createTopic("test-topic");
      TopicControl control = ManagementControlHelper.createTopicControl(topic, mbeanServer);
     
      System.out.println("size = " + control.getMessageCount());
     
      Connection conn2 = cf.createConnection();
     
      conn2.setClientID("client1");
     
      Session sess2 = conn2.createSession(true, Session.SESSION_TRANSACTED);
     
      sess2.createDurableSubscriber(topic, "client-sub1");
      sess2.createDurableSubscriber(topic, "client-sub2");
     
      conn2.close();

      Connection conn = cf.createConnection();
      Session sess = conn.createSession(true, Session.SESSION_TRANSACTED);
      MessageProducer prod = sess.createProducer(topic);
      prod.setTimeToLive(1000);
     
      for (int i = 0 ; i < 100; i++)
      {
         TextMessage txt = sess.createTextMessage("txt");
         prod.send(txt);
      }
     
      sess.commit();
     
      conn.close();

      // minimal time needed
      Thread.sleep(2000);
     
      long timeout = System.currentTimeMillis() + 10000;
     
      // We will wait some time, but we will wait as minimal as possible
      while (control.getMessageCount() != 0 && System.currentTimeMillis() > timeout)
      {
         Thread.sleep(100);
      }
     
      assertEquals(0, control.getMessageCount());
     
     
   }
View Full Code Here

      ManagementService managementService = server0.getManagementService();
      if (index == 1)
      {
         managementService = server1.getManagementService();
      }
      TopicControl topicControl = (TopicControl)managementService.getResource(ResourceNames.JMS_TOPIC + topic.getTopicName());
      Assert.assertEquals(0, topicControl.getSubscriptionCount());

   }
View Full Code Here

      {
         Object[] topicControls = server.getHornetQServer().getManagementService().getResources(TopicControl.class);
         String[] names = new String[topicControls.length];
         for (int i = 0; i < topicControls.length; i++)
         {
            TopicControl topicControl = (TopicControl)topicControls[i];
            names[i] = topicControl.getName();
         }
         return names;
      }
      finally
      {
View Full Code Here

      }

      Object[] topicControls = server.getHornetQServer().getManagementService().getResources(TopicControl.class);
      for (Object topicControl2 : topicControls)
      {
         TopicControl topicControl = (TopicControl)topicControl2;
         allDests.put(topicControl.getAddress(), topicControl);
      }

      List<String> destinations = new ArrayList<String>();
      for (String addresse : addresses)
      {
View Full Code Here

      {
         Object[] topicControls = server.getHornetQServer().getManagementService().getResources(TopicControl.class);
         String[] names = new String[topicControls.length];
         for (int i = 0; i < topicControls.length; i++)
         {
            TopicControl topicControl = (TopicControl)topicControls[i];
            names[i] = topicControl.getName();
         }
         return names;
      }
      finally
      {
View Full Code Here

TOP

Related Classes of org.hornetq.api.jms.management.TopicControl

Copyright © 2018 www.massapicom. 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.