Package org.hornetq.api.jms.management

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


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


      Map<String, DestinationControl> allDests = new HashMap<String, DestinationControl>();

      Object[] queueControls = server.getHornetQServer().getManagementService().getResources(JMSQueueControl.class);
      for (Object queueControl2 : queueControls)
      {
         JMSQueueControl queueControl = (JMSQueueControl)queueControl2;
         allDests.put(queueControl.getAddress(), queueControl);
      }

      Object[] topicControls = server.getHornetQServer().getManagementService().getResources(TopicControl.class);
      for (Object topicControl2 : topicControls)
      {
View Full Code Here

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

      Map<String, DestinationControl> allDests = new HashMap<String, DestinationControl>();

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

      Object[] topicControls = server.getHornetQServer().getManagementService().getResources(TopicControl.class);
      for (int i = 0; i < topicControls.length; i++)
      {
View Full Code Here

    public void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException {

        validator.validate(operation);
        final String attributeName = operation.require(ModelDescriptionConstants.NAME).asString();

        JMSQueueControl control = getControl(context, operation);
        if (control == null) {
            ManagementUtil.rollbackOperationWithNoHandler(context, operation);
            return;
        }

        if (MESSAGE_COUNT.equals(attributeName)) {
            try {
                context.getResult().set(control.getMessageCount());
            } catch (RuntimeException e) {
                throw e;
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        } else if (SCHEDULED_COUNT.equals(attributeName)) {
            context.getResult().set(control.getScheduledCount());
        } else if (CONSUMER_COUNT.equals(attributeName)) {
            context.getResult().set(control.getConsumerCount());
        } else if (DELIVERING_COUNT.equals(attributeName)) {
            context.getResult().set(control.getDeliveringCount());
        } else if (MESSAGES_ADDED.equals(attributeName)) {
            context.getResult().set(control.getMessagesAdded());
        } else if (QUEUE_ADDRESS.getName().equals(attributeName)) {
            context.getResult().set(control.getAddress());
        } else if (EXPIRY_ADDRESS.getName().equals(attributeName)) {
            context.getResult().set(control.getExpiryAddress());
        } else if (DEAD_LETTER_ADDRESS.getName().equals(attributeName)) {
            context.getResult().set(control.getDeadLetterAddress());
        } else if (PAUSED.equals(attributeName)) {
            try {
                context.getResult().set(control.isPaused());
            } catch (RuntimeException e) {
                throw e;
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        } else if (TEMPORARY.equals(attributeName)) {
            context.getResult().set(control.isTemporary());
        } else if (METRICS.contains(attributeName) || READ_ATTRIBUTES.contains(attributeName)) {
            // Bug
            throw MESSAGES.unsupportedAttribute(attributeName);
        }
        context.completeStep();
View Full Code Here

        String queueName = PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR)).getLastElement().getValue();
        final ServiceName hqServiceName = MessagingServices.getHornetQServiceName(PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)));

        ServiceController<?> hqService = context.getServiceRegistry(false).getService(hqServiceName);
        HornetQServer hqServer = HornetQServer.class.cast(hqService.getValue());
        JMSQueueControl control = JMSQueueControl.class.cast(hqServer.getManagementService().getResource(ResourceNames.JMS_QUEUE + queueName));
        return control;
    }
View Full Code Here

    // Construct an ObjectName for JMX access to the Queue
    ObjectName on = ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName);

    // Create a JMSQueueControl proxy to manage the queue on the server
    JMSQueueControl queueControl = MBeanServerInvocationHandler.newProxyInstance(mbsc, on, JMSQueueControl.class, false);

    return queueControl;
  }
View Full Code Here

      long depth = 0;

      if (dConfig.getDomain() == Domain.QUEUE.getId()) {

        log.debug("Looking for depth of queue: " + dest);
        JMSQueueControl queueControl = getQueueControl(dest);
        depth = queueControl.getMessageCount();
      } else {
        log.debug("Looking for depth of queue: " + dest);
        TopicControl topicControl = getTopicControl(dest);
        depth = topicControl.getMessageCount();
      }
View Full Code Here

    try {
      String destination = getRealDestinationName(dConfig);
      log.debug("Generating statistics for : " + destination);

      if (dConfig.getDomain() == Domain.QUEUE.getId()) {
        JMSQueueControl queueControl = getQueueControl(destination);

        stats.put("QueueName", queueControl.getName());
        stats.put("ScheduledCount", queueControl.getScheduledCount());
        stats.put("MessagesAdded", queueControl.getMessagesAdded());
        stats.put("MessageCount", queueControl.getMessageCount());
        stats.put("DeliveringCount", queueControl.getDeliveringCount());
        stats.put("ConsumerCount", queueControl.getConsumerCount());
      } else {
        TopicControl topicControl = getTopicControl(destination);

        stats.put("TopicName", topicControl.getName());
        stats.put("MessageCount", topicControl.getMessageCount());
View Full Code Here

  public int truncate(DestinationConfig dConfig) throws JMSException {
    try {
      String destination = getRealDestinationName(dConfig);

      if (dConfig.getDomain() == Domain.QUEUE.getId()) {
        JMSQueueControl queueControl = getQueueControl(destination);
        return queueControl.removeMessages(null);
      } else {
        throw new HermesException("JBoss does not support truncating a durable subscription");
      }
    } catch (HermesException ex) {
      throw ex;
View Full Code Here

TOP

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

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.