Package org.hornetq.api.jms.management

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


        String factoryName = 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());
        ConnectionFactoryControl control = ConnectionFactoryControl.class.cast(hqServer.getManagementService().getResource(ResourceNames.JMS_CONNECTION_FACTORY + factoryName));

        if (control == null) {
            rollbackOperationWithNoHandler(context, operation);
            return;
        }

        if (HA.getName().equals(attributeName)) {
            context.getResult().set(control.isHA());
        } else if (CONNECTION_FACTORY_TYPE.getName().equals(attributeName)) {
            context.getResult().set(control.getFactoryType());
        } else if (INITIAL_MESSAGE_PACKET_SIZE.equals(attributeName)) {
            context.getResult().set(control.getInitialMessagePacketSize());
        } else if (READ_ATTRIBUTES.contains(attributeName)) {
            // Bug
            throw MESSAGES.unsupportedAttribute(attributeName);
        }
        context.completeStep();
View Full Code Here


        return PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR)).getLastElement().getValue();
    }

    private void applyOperationToHornetQService(final OperationContext context, String name, String attributeName, ModelNode value, ServiceController<?> hqService) {
        HornetQServer server =  HornetQServer.class.cast(hqService.getValue());
        ConnectionFactoryControl control = ConnectionFactoryControl.class.cast(server.getManagementService().getResource(ResourceNames.JMS_CONNECTION_FACTORY + name));
        try {
            if (attributeName.equals(CommonAttributes.CLIENT_ID.getName()))  {
                control.setClientID(value.isDefined() ? value.asString() : null);
            } else if (attributeName.equals(CommonAttributes.COMPRESS_LARGE_MESSAGES.getName())) {
                control.setCompressLargeMessages(value.asBoolean());
            } else if (attributeName.equals(CommonAttributes.CLIENT_FAILURE_CHECK_PERIOD.getName())) {
                control.setClientFailureCheckPeriod(value.asLong());
            } else if (attributeName.equals(CommonAttributes.CALL_TIMEOUT.getName())) {
                control.setCallTimeout(value.asLong());
            } else if (attributeName.equals(CommonAttributes.DUPS_OK_BATCH_SIZE.getName())) {
                control.setDupsOKBatchSize(value.asInt());
            } else if (attributeName.equals(CommonAttributes.CONSUMER_MAX_RATE.getName())) {
                control.setConsumerMaxRate(value.asInt());
            } else if (attributeName.equals(CommonAttributes.CONSUMER_WINDOW_SIZE.getName())) {
                control.setConsumerWindowSize(value.asInt());
            } else if (attributeName.equals(CommonAttributes.PRODUCER_MAX_RATE.getName())) {
                control.setProducerMaxRate(value.asInt());
            } else if (attributeName.equals(CommonAttributes.CONFIRMATION_WINDOW_SIZE.getName())) {
                control.setConfirmationWindowSize(value.asInt());
            } else if (attributeName.equals(CommonAttributes.BLOCK_ON_ACK.getName())) {
                control.setBlockOnAcknowledge(value.asBoolean());
            } else if (attributeName.equals(CommonAttributes.BLOCK_ON_DURABLE_SEND.getName())) {
                control.setBlockOnDurableSend(value.asBoolean());
            } else if (attributeName.equals(CommonAttributes.BLOCK_ON_NON_DURABLE_SEND.getName())) {
                control.setBlockOnNonDurableSend(value.asBoolean());
            } else if (attributeName.equals(CommonAttributes.PRE_ACK.getName())) {
                control.setPreAcknowledge(value.asBoolean());
            } else if (attributeName.equals(CommonAttributes.CONNECTION_TTL.getName())) {
                control.setConnectionTTL(value.asLong());
            } else if (attributeName.equals(CommonAttributes.TRANSACTION_BATCH_SIZE.getName())) {
                control.setTransactionBatchSize(value.asInt());
            } else if (attributeName.equals(CommonAttributes.MIN_LARGE_MESSAGE_SIZE.getName())) {
                control.setMinLargeMessageSize(value.asInt());
            } else if (attributeName.equals(CommonAttributes.AUTO_GROUP.getName())) {
                control.setAutoGroup(value.asBoolean());
            } else if (attributeName.equals(CommonAttributes.RETRY_INTERVAL.getName())) {
                control.setRetryInterval(value.asLong());
            } else if (attributeName.equals(CommonAttributes.RETRY_INTERVAL_MULTIPLIER.getName())) {
                control.setRetryIntervalMultiplier(value.asDouble());
            } else if (attributeName.equals(CommonAttributes.CONNECTION_FACTORY_RECONNECT_ATTEMPTS.getName())) {
                control.setReconnectAttempts(value.asInt());
            } else if (attributeName.equals(CommonAttributes.FAILOVER_ON_INITIAL_CONNECTION.getName())) {
                control.setFailoverOnInitialConnection(value.asBoolean());
            } else if (attributeName.equals(CommonAttributes.PRODUCER_WINDOW_SIZE.getName())) {
                control.setProducerWindowSize(value.asInt());
            } else if (attributeName.equals(CommonAttributes.CACHE_LARGE_MESSAGE_CLIENT.getName())) {
                control.setCacheLargeMessagesClient(value.asBoolean());
            } else if (attributeName.equals(CommonAttributes.MAX_RETRY_INTERVAL.getName())) {
                control.setMaxRetryInterval(value.asLong());
            } else if (attributeName.equals(CommonAttributes.CONNECTION_SCHEDULED_THREAD_POOL_MAX_SIZE.getName())) {
                control.setScheduledThreadPoolMaxSize(value.asInt());
            } else if (attributeName.equals(CommonAttributes.CONNECTION_THREAD_POOL_MAX_SIZE.getName())) {
                control.setThreadPoolMaxSize(value.asInt());
            } else if (attributeName.equals(CommonAttributes.GROUP_ID.getName())) {
                control.setGroupID(value.isDefined() ? value.asString() : null);
            } else if (attributeName.equals(CommonAttributes.USE_GLOBAL_POOLS.getName())) {
                control.setUseGlobalPools(value.asBoolean());
            } else if (attributeName.equals(CommonAttributes.LOAD_BALANCING_CLASS_NAME.getName())) {
                control.setConnectionLoadBalancingPolicyClassName(value.asString());
            } else {
                // Bug! Someone added the attribute to the set but did not implement
                throw MESSAGES.unsupportedRuntimeAttribute(attributeName);
            }
View Full Code Here

                attributeName.equals(Common.DISCOVERY_GROUP_NAME.getName())) {
            return;
        }

        HornetQServer server =  HornetQServer.class.cast(hqService.getValue());
        ConnectionFactoryControl control = ConnectionFactoryControl.class.cast(server.getManagementService().getResource(ResourceNames.JMS_CONNECTION_FACTORY + name));
        try {
            if (attributeName.equals(CommonAttributes.CLIENT_ID.getName()))  {
                control.setClientID(value.isDefined() ? value.asString() : null);
            } else if (attributeName.equals(Common.COMPRESS_LARGE_MESSAGES.getName())) {
                control.setCompressLargeMessages(value.asBoolean());
            } else if (attributeName.equals(Common.CLIENT_FAILURE_CHECK_PERIOD.getName())) {
                control.setClientFailureCheckPeriod(value.asLong());
            } else if (attributeName.equals(CommonAttributes.CALL_TIMEOUT.getName())) {
                control.setCallTimeout(value.asLong());
            } else if (attributeName.equals(CommonAttributes.CALL_FAILOVER_TIMEOUT.getName())) {
                control.setCallFailoverTimeout(value.asLong());
            }else if (attributeName.equals(Common.DUPS_OK_BATCH_SIZE.getName())) {
                control.setDupsOKBatchSize(value.asInt());
            } else if (attributeName.equals(Common.CONSUMER_MAX_RATE.getName())) {
                control.setConsumerMaxRate(value.asInt());
            } else if (attributeName.equals(Common.CONSUMER_WINDOW_SIZE.getName())) {
                control.setConsumerWindowSize(value.asInt());
            } else if (attributeName.equals(Common.PRODUCER_MAX_RATE.getName())) {
                control.setProducerMaxRate(value.asInt());
            } else if (attributeName.equals(Common.CONFIRMATION_WINDOW_SIZE.getName())) {
                control.setConfirmationWindowSize(value.asInt());
            } else if (attributeName.equals(Common.BLOCK_ON_ACKNOWLEDGE.getName())) {
                control.setBlockOnAcknowledge(value.asBoolean());
            } else if (attributeName.equals(Common.BLOCK_ON_DURABLE_SEND.getName())) {
                control.setBlockOnDurableSend(value.asBoolean());
            } else if (attributeName.equals(Common.BLOCK_ON_NON_DURABLE_SEND.getName())) {
                control.setBlockOnNonDurableSend(value.asBoolean());
            } else if (attributeName.equals(Common.PRE_ACKNOWLEDGE.getName())) {
                control.setPreAcknowledge(value.asBoolean());
            } else if (attributeName.equals(Common.CONNECTION_TTL.getName())) {
                control.setConnectionTTL(value.asLong());
            } else if (attributeName.equals(Common.TRANSACTION_BATCH_SIZE.getName())) {
                control.setTransactionBatchSize(value.asInt());
            } else if (attributeName.equals(CommonAttributes.MIN_LARGE_MESSAGE_SIZE.getName())) {
                control.setMinLargeMessageSize(value.asInt());
            } else if (attributeName.equals(Common.AUTO_GROUP.getName())) {
                control.setAutoGroup(value.asBoolean());
            } else if (attributeName.equals(Common.RETRY_INTERVAL.getName())) {
                control.setRetryInterval(value.asLong());
            } else if (attributeName.equals(Common.RETRY_INTERVAL_MULTIPLIER.getName())) {
                control.setRetryIntervalMultiplier(value.asDouble());
            } else if (attributeName.equals(Common.RECONNECT_ATTEMPTS.getName())) {
                control.setReconnectAttempts(value.asInt());
            } else if (attributeName.equals(Common.FAILOVER_ON_INITIAL_CONNECTION.getName())) {
                control.setFailoverOnInitialConnection(value.asBoolean());
            } else if (attributeName.equals(Common.PRODUCER_WINDOW_SIZE.getName())) {
                control.setProducerWindowSize(value.asInt());
            } else if (attributeName.equals(Common.CACHE_LARGE_MESSAGE_CLIENT.getName())) {
                control.setCacheLargeMessagesClient(value.asBoolean());
            } else if (attributeName.equals(CommonAttributes.MAX_RETRY_INTERVAL.getName())) {
                control.setMaxRetryInterval(value.asLong());
            } else if (attributeName.equals(Common.SCHEDULED_THREAD_POOL_MAX_SIZE.getName())) {
                control.setScheduledThreadPoolMaxSize(value.asInt());
            } else if (attributeName.equals(Common.THREAD_POOL_MAX_SIZE.getName())) {
                control.setThreadPoolMaxSize(value.asInt());
            } else if (attributeName.equals(Common.GROUP_ID.getName())) {
                control.setGroupID(value.isDefined() ? value.asString() : null);
            } else if (attributeName.equals(Common.USE_GLOBAL_POOLS.getName())) {
                control.setUseGlobalPools(value.asBoolean());
            } else if (attributeName.equals(Common.CONNECTION_LOAD_BALANCING_CLASS_NAME.getName())) {
                control.setConnectionLoadBalancingPolicyClassName(value.asString());
            } else {
                // Bug! Someone added the attribute to the set but did not implement
                throw MessagingLogger.ROOT_LOGGER.unsupportedRuntimeAttribute(attributeName);
            }
View Full Code Here

        String factoryName = 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());
        ConnectionFactoryControl control = ConnectionFactoryControl.class.cast(hqServer.getManagementService().getResource(ResourceNames.JMS_CONNECTION_FACTORY + factoryName));

        if (control == null) {
            PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
            throw ControllerLogger.ROOT_LOGGER.managementResourceNotFound(address);
        }

        if (HA.getName().equals(attributeName)) {
            context.getResult().set(control.isHA());
        } else if (ConnectionFactoryAttributes.Regular.FACTORY_TYPE.getName().equals(attributeName)) {
            context.getResult().set(control.getFactoryType());
        } else if (ConnectionFactoryAttributes.Regular.INITIAL_MESSAGE_PACKET_SIZE.getName().equals(attributeName)) {
            context.getResult().set(control.getInitialMessagePacketSize());
        } else {
            // Bug
            throw MessagingLogger.ROOT_LOGGER.unsupportedAttribute(attributeName);
        }
        context.stepCompleted();
View Full Code Here

                                     .getManagementService()
                                     .getResources(ConnectionFactoryControl.class);
         String[] names = new String[cfControls.length];
         for (int i = 0; i < cfControls.length; i++)
         {
            ConnectionFactoryControl cfControl = (ConnectionFactoryControl)cfControls[i];
            names[i] = cfControl.getName();
         }
         return names;
      }
      finally
      {
View Full Code Here

                                     .getManagementService()
                                     .getResources(ConnectionFactoryControl.class);
         String[] names = new String[cfControls.length];
         for (int i = 0; i < cfControls.length; i++)
         {
            ConnectionFactoryControl cfControl = (ConnectionFactoryControl)cfControls[i];
            names[i] = cfControl.getName();
         }
         return names;
      }
      finally
      {
View Full Code Here

   public void testCreateCF() throws Exception
   {
      JMSServerControl control = createJMSControl();
      control.createConnectionFactory("test", false, false, 0, "invm", "test");

      ConnectionFactoryControl controlCF = createCFControl("test");

      HornetQConnectionFactory cf = (HornetQConnectionFactory)ctx.lookup("test");

      assertFalse(cf.isCompressLargeMessage());

      controlCF.setCompressLargeMessages(true);

      cf = (HornetQConnectionFactory)ctx.lookup("test");
      assertTrue(cf.isCompressLargeMessage());

      stopServer();
View Full Code Here

                                     .getManagementService()
                                     .getResources(ConnectionFactoryControl.class);
         String[] names = new String[cfControls.length];
         for (int i = 0; i < cfControls.length; i++)
         {
            ConnectionFactoryControl cfControl = (ConnectionFactoryControl)cfControls[i];
            names[i] = cfControl.getName();
         }
         return names;
      }
      finally
      {
View Full Code Here

            .getManagementService()
            .getResources(ConnectionFactoryControl.class);
         String[] names = new String[cfControls.length];
         for (int i = 0; i < cfControls.length; i++)
         {
            ConnectionFactoryControl cfControl = (ConnectionFactoryControl)cfControls[i];
            names[i] = cfControl.getName();
         }
         return names;
      }
      finally
      {
View Full Code Here

            .getManagementService()
            .getResources(ConnectionFactoryControl.class);
         String[] names = new String[cfControls.length];
         for (int i = 0; i < cfControls.length; i++)
         {
            ConnectionFactoryControl cfControl = (ConnectionFactoryControl) cfControls[i];
            names[i] = cfControl.getName();
         }
         return names;
      }
      finally
      {
View Full Code Here

TOP

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

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.