Search in sources :

Example 1 with JMSFactoryType

use of org.hornetq.api.jms.JMSFactoryType in project wildfly by wildfly.

the class LegacyConnectionFactoryAdd method createLegacyConnectionFactory.

private HornetQConnectionFactory createLegacyConnectionFactory(OperationContext context, ModelNode model) throws OperationFailedException {
    boolean ha = LegacyConnectionFactoryDefinition.HA.resolveModelAttribute(context, model).asBoolean();
    String factoryTypeStr = LegacyConnectionFactoryDefinition.FACTORY_TYPE.resolveModelAttribute(context, model).asString();
    JMSFactoryType factoryType = LegacyConnectionFactoryDefinition.HornetQConnectionFactoryType.valueOf(factoryTypeStr).getType();
    final HornetQConnectionFactory incompleteCF;
    if (ha) {
        incompleteCF = HornetQJMSClient.createConnectionFactoryWithHA(factoryType);
    } else {
        incompleteCF = HornetQJMSClient.createConnectionFactoryWithoutHA(factoryType);
    }
    incompleteCF.setAutoGroup(AUTO_GROUP.resolveModelAttribute(context, model).asBoolean());
    incompleteCF.setBlockOnAcknowledge(BLOCK_ON_ACKNOWLEDGE.resolveModelAttribute(context, model).asBoolean());
    incompleteCF.setBlockOnDurableSend(BLOCK_ON_DURABLE_SEND.resolveModelAttribute(context, model).asBoolean());
    incompleteCF.setBlockOnNonDurableSend(BLOCK_ON_NON_DURABLE_SEND.resolveModelAttribute(context, model).asBoolean());
    incompleteCF.setCacheLargeMessagesClient(CACHE_LARGE_MESSAGE_CLIENT.resolveModelAttribute(context, model).asBoolean());
    incompleteCF.setCallFailoverTimeout(CALL_FAILOVER_TIMEOUT.resolveModelAttribute(context, model).asLong());
    incompleteCF.setCallTimeout(CALL_TIMEOUT.resolveModelAttribute(context, model).asLong());
    incompleteCF.setClientFailureCheckPeriod(CLIENT_FAILURE_CHECK_PERIOD.resolveModelAttribute(context, model).asLong());
    final ModelNode clientID = CLIENT_ID.resolveModelAttribute(context, model);
    if (clientID.isDefined()) {
        incompleteCF.setClientID(clientID.asString());
    }
    incompleteCF.setCompressLargeMessage(COMPRESS_LARGE_MESSAGES.resolveModelAttribute(context, model).asBoolean());
    incompleteCF.setConfirmationWindowSize(CONFIRMATION_WINDOW_SIZE.resolveModelAttribute(context, model).asInt());
    final ModelNode connectionLoadBalancingClassName = CONNECTION_LOAD_BALANCING_CLASS_NAME.resolveModelAttribute(context, model);
    if (connectionLoadBalancingClassName.isDefined()) {
        incompleteCF.setConnectionLoadBalancingPolicyClassName(connectionLoadBalancingClassName.asString());
    }
    incompleteCF.setConnectionTTL(CONNECTION_TTL.resolveModelAttribute(context, model).asLong());
    incompleteCF.setConsumerMaxRate(CONSUMER_MAX_RATE.resolveModelAttribute(context, model).asInt());
    incompleteCF.setConsumerWindowSize(CONSUMER_WINDOW_SIZE.resolveModelAttribute(context, model).asInt());
    incompleteCF.setConfirmationWindowSize(CONFIRMATION_WINDOW_SIZE.resolveModelAttribute(context, model).asInt());
    incompleteCF.setDupsOKBatchSize(DUPS_OK_BATCH_SIZE.resolveModelAttribute(context, model).asInt());
    incompleteCF.setFailoverOnInitialConnection(FAILOVER_ON_INITIAL_CONNECTION.resolveModelAttribute(context, model).asBoolean());
    final ModelNode groupID = GROUP_ID.resolveModelAttribute(context, model);
    if (groupID.isDefined()) {
        incompleteCF.setGroupID(groupID.asString());
    }
    incompleteCF.setInitialConnectAttempts(INITIAL_CONNECT_ATTEMPTS.resolveModelAttribute(context, model).asInt());
    incompleteCF.setInitialMessagePacketSize(INITIAL_MESSAGE_PACKET_SIZE.resolveModelAttribute(context, model).asInt());
    incompleteCF.setMaxRetryInterval(MAX_RETRY_INTERVAL.resolveModelAttribute(context, model).asLong());
    incompleteCF.setMinLargeMessageSize(MIN_LARGE_MESSAGE_SIZE.resolveModelAttribute(context, model).asInt());
    incompleteCF.setPreAcknowledge(PRE_ACKNOWLEDGE.resolveModelAttribute(context, model).asBoolean());
    incompleteCF.setProducerMaxRate(PRODUCER_MAX_RATE.resolveModelAttribute(context, model).asInt());
    incompleteCF.setProducerWindowSize(PRODUCER_WINDOW_SIZE.resolveModelAttribute(context, model).asInt());
    incompleteCF.setReconnectAttempts(RECONNECT_ATTEMPTS.resolveModelAttribute(context, model).asInt());
    incompleteCF.setRetryInterval(RETRY_INTERVAL.resolveModelAttribute(context, model).asLong());
    incompleteCF.setRetryIntervalMultiplier(RETRY_INTERVAL_MULTIPLIER.resolveModelAttribute(context, model).asDouble());
    incompleteCF.setScheduledThreadPoolMaxSize(SCHEDULED_THREAD_POOL_MAX_SIZE.resolveModelAttribute(context, model).asInt());
    incompleteCF.setThreadPoolMaxSize(THREAD_POOL_MAX_SIZE.resolveModelAttribute(context, model).asInt());
    incompleteCF.setTransactionBatchSize(TRANSACTION_BATCH_SIZE.resolveModelAttribute(context, model).asInt());
    incompleteCF.setUseGlobalPools(USE_GLOBAL_POOLS.resolveModelAttribute(context, model).asBoolean());
    return incompleteCF;
}
Also used : HornetQConnectionFactory(org.hornetq.jms.client.HornetQConnectionFactory) JMSFactoryType(org.hornetq.api.jms.JMSFactoryType) ModelNode(org.jboss.dmr.ModelNode)

Example 2 with JMSFactoryType

use of org.hornetq.api.jms.JMSFactoryType in project wildfly by wildfly.

the class LegacyConnectionFactoryService method start.

@Override
public void start(StartContext context) throws StartException {
    ActiveMQServer activeMQServer = injectedActiveMQServer.getValue();
    DiscoveryGroupConfiguration discoveryGroupConfiguration = null;
    if (discoveryGroupName != null) {
        if (activeMQServer.getConfiguration().getDiscoveryGroupConfigurations().keySet().contains(discoveryGroupName)) {
            discoveryGroupConfiguration = translateDiscoveryGroupConfiguration(activeMQServer.getConfiguration().getDiscoveryGroupConfigurations().get(discoveryGroupName));
        } else {
            throw MessagingLogger.ROOT_LOGGER.discoveryGroupIsNotDefined(discoveryGroupName);
        }
    }
    TransportConfiguration[] transportConfigurations = translateTransportGroupConfigurations(activeMQServer.getConfiguration().getConnectorConfigurations(), connectors);
    JMSFactoryType factoryType = JMSFactoryType.valueOf(uncompletedConnectionFactory.getFactoryType());
    if (uncompletedConnectionFactory.isHA()) {
        if (discoveryGroupConfiguration != null) {
            connectionFactory = HornetQJMSClient.createConnectionFactoryWithHA(discoveryGroupConfiguration, factoryType);
        } else {
            connectionFactory = HornetQJMSClient.createConnectionFactoryWithHA(factoryType, transportConfigurations);
        }
    } else {
        if (discoveryGroupConfiguration != null) {
            connectionFactory = HornetQJMSClient.createConnectionFactoryWithoutHA(discoveryGroupConfiguration, factoryType);
        } else {
            connectionFactory = HornetQJMSClient.createConnectionFactoryWithoutHA(factoryType, transportConfigurations);
        }
    }
    connectionFactory.setAutoGroup(uncompletedConnectionFactory.isAutoGroup());
    connectionFactory.setBlockOnAcknowledge(uncompletedConnectionFactory.isBlockOnAcknowledge());
    connectionFactory.setBlockOnDurableSend(uncompletedConnectionFactory.isBlockOnDurableSend());
    connectionFactory.setBlockOnNonDurableSend(uncompletedConnectionFactory.isBlockOnNonDurableSend());
    connectionFactory.setCacheLargeMessagesClient(uncompletedConnectionFactory.isCacheLargeMessagesClient());
    connectionFactory.setCallFailoverTimeout(uncompletedConnectionFactory.getCallFailoverTimeout());
    connectionFactory.setCallTimeout(uncompletedConnectionFactory.getCallTimeout());
    connectionFactory.setClientFailureCheckPeriod(uncompletedConnectionFactory.getClientFailureCheckPeriod());
    connectionFactory.setClientID(uncompletedConnectionFactory.getClientID());
    connectionFactory.setCompressLargeMessage(uncompletedConnectionFactory.isCompressLargeMessage());
    connectionFactory.setConfirmationWindowSize(uncompletedConnectionFactory.getConfirmationWindowSize());
    connectionFactory.setConnectionLoadBalancingPolicyClassName(uncompletedConnectionFactory.getConnectionLoadBalancingPolicyClassName());
    connectionFactory.setConnectionTTL(uncompletedConnectionFactory.getConnectionTTL());
    connectionFactory.setConsumerMaxRate(uncompletedConnectionFactory.getConsumerMaxRate());
    connectionFactory.setConsumerWindowSize(uncompletedConnectionFactory.getConsumerWindowSize());
    connectionFactory.setConfirmationWindowSize(uncompletedConnectionFactory.getConfirmationWindowSize());
    connectionFactory.setDupsOKBatchSize(uncompletedConnectionFactory.getDupsOKBatchSize());
    connectionFactory.setFailoverOnInitialConnection(uncompletedConnectionFactory.isFailoverOnInitialConnection());
    connectionFactory.setGroupID(uncompletedConnectionFactory.getGroupID());
    connectionFactory.setInitialConnectAttempts(uncompletedConnectionFactory.getInitialConnectAttempts());
    connectionFactory.setInitialMessagePacketSize(uncompletedConnectionFactory.getInitialMessagePacketSize());
    connectionFactory.setMaxRetryInterval(uncompletedConnectionFactory.getMaxRetryInterval());
    connectionFactory.setMinLargeMessageSize(uncompletedConnectionFactory.getMinLargeMessageSize());
    connectionFactory.setPreAcknowledge(uncompletedConnectionFactory.isPreAcknowledge());
    connectionFactory.setProducerMaxRate(uncompletedConnectionFactory.getProducerMaxRate());
    connectionFactory.setProducerWindowSize(uncompletedConnectionFactory.getProducerWindowSize());
    connectionFactory.setReconnectAttempts(uncompletedConnectionFactory.getReconnectAttempts());
    connectionFactory.setRetryInterval(uncompletedConnectionFactory.getRetryInterval());
    connectionFactory.setRetryIntervalMultiplier(uncompletedConnectionFactory.getRetryIntervalMultiplier());
    connectionFactory.setScheduledThreadPoolMaxSize(uncompletedConnectionFactory.getScheduledThreadPoolMaxSize());
    connectionFactory.setThreadPoolMaxSize(uncompletedConnectionFactory.getThreadPoolMaxSize());
    connectionFactory.setTransactionBatchSize(uncompletedConnectionFactory.getTransactionBatchSize());
    connectionFactory.setUseGlobalPools(uncompletedConnectionFactory.isUseGlobalPools());
}
Also used : ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) JMSFactoryType(org.hornetq.api.jms.JMSFactoryType) TransportConfiguration(org.hornetq.api.core.TransportConfiguration) DiscoveryGroupConfiguration(org.hornetq.api.core.DiscoveryGroupConfiguration)

Aggregations

JMSFactoryType (org.hornetq.api.jms.JMSFactoryType)2 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)1 DiscoveryGroupConfiguration (org.hornetq.api.core.DiscoveryGroupConfiguration)1 TransportConfiguration (org.hornetq.api.core.TransportConfiguration)1 HornetQConnectionFactory (org.hornetq.jms.client.HornetQConnectionFactory)1 ModelNode (org.jboss.dmr.ModelNode)1