Search in sources :

Example 1 with DiscoveryGroupConfiguration

use of org.hornetq.api.core.DiscoveryGroupConfiguration 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)

Example 2 with DiscoveryGroupConfiguration

use of org.hornetq.api.core.DiscoveryGroupConfiguration in project wildfly by wildfly.

the class LegacyConnectionFactoryService method translateDiscoveryGroupConfiguration.

private DiscoveryGroupConfiguration translateDiscoveryGroupConfiguration(org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration newDiscoveryGroupConfiguration) throws StartException {
    org.apache.activemq.artemis.api.core.BroadcastEndpointFactory newBroadcastEndpointFactory = newDiscoveryGroupConfiguration.getBroadcastEndpointFactory();
    BroadcastEndpointFactoryConfiguration legacyBroadcastEndpointFactory;
    if (newBroadcastEndpointFactory instanceof org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory) {
        org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory factory = (org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory) newBroadcastEndpointFactory;
        legacyBroadcastEndpointFactory = new UDPBroadcastGroupConfiguration(factory.getGroupAddress(), factory.getGroupPort(), factory.getLocalBindAddress(), factory.getLocalBindPort());
    } else if (newBroadcastEndpointFactory instanceof org.apache.activemq.artemis.api.core.ChannelBroadcastEndpointFactory) {
        org.apache.activemq.artemis.api.core.ChannelBroadcastEndpointFactory factory = (org.apache.activemq.artemis.api.core.ChannelBroadcastEndpointFactory) newBroadcastEndpointFactory;
        legacyBroadcastEndpointFactory = new org.hornetq.api.core.JGroupsBroadcastGroupConfiguration(factory.getChannel(), factory.getChannelName());
    } else {
        throw MessagingLogger.ROOT_LOGGER.unsupportedBroadcastGroupConfigurationForLegacy(newBroadcastEndpointFactory.getClass().getName());
    }
    return new DiscoveryGroupConfiguration(newDiscoveryGroupConfiguration.getName(), newDiscoveryGroupConfiguration.getRefreshTimeout(), newDiscoveryGroupConfiguration.getDiscoveryInitialWaitTimeout(), legacyBroadcastEndpointFactory);
}
Also used : BroadcastEndpointFactoryConfiguration(org.hornetq.api.core.BroadcastEndpointFactoryConfiguration) DiscoveryGroupConfiguration(org.hornetq.api.core.DiscoveryGroupConfiguration) UDPBroadcastGroupConfiguration(org.hornetq.api.core.UDPBroadcastGroupConfiguration)

Aggregations

DiscoveryGroupConfiguration (org.hornetq.api.core.DiscoveryGroupConfiguration)2 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)1 BroadcastEndpointFactoryConfiguration (org.hornetq.api.core.BroadcastEndpointFactoryConfiguration)1 TransportConfiguration (org.hornetq.api.core.TransportConfiguration)1 UDPBroadcastGroupConfiguration (org.hornetq.api.core.UDPBroadcastGroupConfiguration)1 JMSFactoryType (org.hornetq.api.jms.JMSFactoryType)1