Package org.hornetq.api.jms.management

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


       params = {@ManagementParameter(name = "name", description = "the queue name")})
   @MetaMapping(value = AddressSettingsMapper.class)
   public Object[] getTopicConfiguration(String name) throws Exception
   {
      Object[] config = new Object[3];
      TopicControl control = (TopicControl) managementService.getResource(name);
      TopicConfiguration topicConfiguration = new TopicConfigurationImpl(control.getName(), control.getJNDIBindings());
      config[0] = topicConfiguration;
      String jsonString = hornetQServerControl.getAddressSettingsAsJSON(name);
      config[1] = AddressSettingsInfo.from(jsonString);
      String rolesAsJSON = hornetQServerControl.getRolesAsJSON(name);
      RoleInfo[] roles = RoleInfo.from(rolesAsJSON);
View Full Code Here


       params = {
           @ManagementParameter(name = "name", description = "the queue name"),
           @ManagementParameter(name = "names", description = "the measurement names")})
   public String[] getTopicMeasurements(String name, String[] names) throws Exception
   {
      TopicControl control = (TopicControl) managementService.getResource(name);
      String[] val = new String[names.length];
      for (int i = 0, valLength = val.length; i < valLength; i++)
      {
         Object o = control.getClass().getMethod(names[i]).invoke(control);
         if(o instanceof Object[])
         {
            val[i] = coomaSeparatedString((Object[]) o);
         }
         else
View Full Code Here

           @ManagementParameter(name = "name", description = "the topic name"),
           @ManagementParameter(name = "method", description = "the method"),
           @ManagementParameter(name = "params", description = "the method params")})
   public Object invokeTopicOperation(String name, String method, String[] params, String[] type) throws Exception
   {
      TopicControl control = (TopicControl) managementService.getResource(name);
      Class[] classes = getClassTypes(type);
      Method m = control.getClass().getMethod(method, classes);
      return m.invoke(control, getParams(params, classes));
   }
View Full Code Here

           @ManagementParameter(name = "method", description = "the method"),
           @ManagementParameter(name = "params", description = "the method params")})
   @MetaMapping(value = MessageListMapper.class)
   public List invokeTopicOperationMessageType(String name, String method, String[] params, String[] type) throws Exception
   {
      TopicControl control = (TopicControl) managementService.getResource(name);
      Class[] classes = getClassTypes(type);
      Method m = control.getClass().getMethod(method, classes);

      Map<String, Serializable>[] maps = (Map<String, Serializable>[]) m.invoke(control, getParams(params, classes));
      List list = new ArrayList();
      list.addAll(Arrays.asList(maps));
      return list;
View Full Code Here

           @ManagementParameter(name = "method", description = "the method"),
           @ManagementParameter(name = "params", description = "the method params")})
   @MetaMapping(value = SubscriptionInfoMapper.class)
   public Object[] invokeTopicOperationSubscriptionType(String name, String method, String[] params, String[] type) throws Exception
   {
      TopicControl control = (TopicControl) managementService.getResource(name);
      Class[] classes = getClassTypes(type);
      Method m = control.getClass().getMethod(method, classes);

      Object[] maps = (Object[]) m.invoke(control, getParams(params, classes));
      return maps;
   }
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

        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());
        TopicControl control = TopicControl.class.cast(hqServer.getManagementService().getResource(ResourceNames.JMS_TOPIC + topicName));

        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 (DELIVERING_COUNT.equals(attributeName)) {
            context.getResult().set(control.getDeliveringCount());
        } else if (MESSAGES_ADDED.equals(attributeName)) {
            context.getResult().set(control.getMessagesAdded());
        } else if (DURABLE_MESSAGE_COUNT.equals(attributeName)) {
            context.getResult().set(control.getDurableMessageCount());
        } else if (NON_DURABLE_MESSAGE_COUNT.equals(attributeName)) {
            context.getResult().set(control.getNonDurableMessageCount());
        } else if (SUBSCRIPTION_COUNT.equals(attributeName)) {
            context.getResult().set(control.getSubscriptionCount());
        } else if (DURABLE_SUBSCRIPTION_COUNT.equals(attributeName)) {
            context.getResult().set(control.getDurableSubscriptionCount());
        } else if (NON_DURABLE_SUBSCRIPTION_COUNT.equals(attributeName)) {
            context.getResult().set(control.getNonDurableSubscriptionCount());
        } else if (TOPIC_ADDRESS.equals(attributeName)) {
            context.getResult().set(control.getAddress());
        } 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

        final String operationName = operation.require(ModelDescriptionConstants.OP).asString();
        final String topicName = PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR)).getLastElement().getValue();
        ServiceController<?> hqService = context.getServiceRegistry(false).getService(hqServiceName);
        HornetQServer hqServer = HornetQServer.class.cast(hqService.getValue());
        TopicControl control = TopicControl.class.cast(hqServer.getManagementService().getResource(ResourceNames.JMS_TOPIC + topicName));

        try {
            if (LIST_ALL_SUBSCRIPTIONS.equals(operationName)) {
                String json = control.listAllSubscriptionsAsJSON();
                ModelNode jsonAsNode = ModelNode.fromJSONString(json);
                context.getResult().set(jsonAsNode);
            } else if (LIST_ALL_SUBSCRIPTIONS_AS_JSON.equals(operationName)) {
                context.getResult().set(control.listAllSubscriptionsAsJSON());
            } else if (LIST_DURABLE_SUBSCRIPTIONS.equals(operationName)) {
                String json = control.listDurableSubscriptionsAsJSON();
                ModelNode jsonAsNode = ModelNode.fromJSONString(json);
                context.getResult().set(jsonAsNode);
            } else if (LIST_DURABLE_SUBSCRIPTIONS_AS_JSON.equals(operationName)) {
                context.getResult().set(control.listDurableSubscriptionsAsJSON());
            } else if (LIST_NON_DURABLE_SUBSCRIPTIONS.equals(operationName)) {
                String json = control.listNonDurableSubscriptionsAsJSON();
                ModelNode jsonAsNode = ModelNode.fromJSONString(json);
                context.getResult().set(jsonAsNode);
            } else if (LIST_NON_DURABLE_SUBSCRIPTIONS_AS_JSON.equals(operationName)) {
                context.getResult().set(control.listNonDurableSubscriptionsAsJSON());
            } else if (LIST_MESSAGES_FOR_SUBSCRIPTION.equals(operationName)) {
                listMessagesForSubscriptionValidator.validate(operation);
                final String queueName = operation.require(QUEUE_NAME.getName()).asString();
                String json = control.listMessagesForSubscriptionAsJSON(queueName);
                context.getResult().set(ModelNode.fromJSONString(json));
            } else if (LIST_MESSAGES_FOR_SUBSCRIPTION_AS_JSON.equals(operationName)) {
                final String queueName = operation.require(QUEUE_NAME.getName()).asString();
                context.getResult().set(control.listMessagesForSubscriptionAsJSON(queueName));
            } else if (COUNT_MESSAGES_FOR_SUBSCRIPTION.equals(operationName)) {
                countMessagesForSubscriptionValidator.validate(operation);
                String clientId = operation.require(CLIENT_ID.getName()).asString();
                String subscriptionName = operation.require(SUBSCRIPTION_NAME).asString();
                String filter = operation.hasDefined(FILTER.getName()) ? operation.get(FILTER.getName()).asString() : null;
                context.getResult().set(control.countMessagesForSubscription(clientId, subscriptionName, filter));
            } else if (DROP_DURABLE_SUBSCRIPTION.equals(operationName)) {
                dropDurableSubscriptionValidator.validate(operation);
                String clientId = operation.require(CLIENT_ID.getName()).asString();
                String subscriptionName = operation.require(SUBSCRIPTION_NAME).asString();
                control.dropDurableSubscription(clientId, subscriptionName);
                context.getResult();
            } else if (DROP_ALL_SUBSCRIPTIONS.equals(operationName)) {
                control.dropAllSubscriptions();
                context.getResult();
            } else if (REMOVE_MESSAGES.equals(operationName)) {
                removeMessagesValidator.validate(operation);
                String filter = operation.hasDefined(FILTER.getName()) ? operation.get(FILTER.getName()).asString() : null;
                context.getResult().set(control.removeMessages(filter));
            } else {
                // Bug
                throw MESSAGES.unsupportedOperation(operationName);
            }
        } catch (RuntimeException e) {
View Full Code Here

    }

    @Override
    protected void addJndiNameToControl(String toAdd, String resourceName, HornetQServer server, OperationContext context) {
        ManagementService mgmt = server.getManagementService();
        TopicControl control = TopicControl.class.cast(mgmt.getResource(ResourceNames.JMS_TOPIC + resourceName));
        try {
            control.addJNDI(toAdd);
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            context.getFailureDescription().set(e.getLocalizedMessage());
        }
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.