Java Code Examples for org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory#setProtocolManagerFactoryStr()

The following examples show how to use org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory#setProtocolManagerFactoryStr() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JMSServerManagerImpl.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
/**
 * @param cfConfig
 * @return
 * @throws ActiveMQException
 */
protected ActiveMQConnectionFactory internalCreateCFPOJO(final ConnectionFactoryConfiguration cfConfig) throws ActiveMQException {
   ActiveMQConnectionFactory cf;
   if (cfConfig.getDiscoveryGroupName() != null) {
      DiscoveryGroupConfiguration groupConfig = server.getConfiguration().getDiscoveryGroupConfigurations().get(cfConfig.getDiscoveryGroupName());

      if (groupConfig == null) {
         throw ActiveMQJMSServerBundle.BUNDLE.discoveryGroupDoesntExist(cfConfig.getDiscoveryGroupName());
      }

      if (cfConfig.isHA()) {
         cf = ActiveMQJMSClient.createConnectionFactoryWithHA(groupConfig, cfConfig.getFactoryType());
      } else {
         cf = ActiveMQJMSClient.createConnectionFactoryWithoutHA(groupConfig, cfConfig.getFactoryType());
      }
   } else {
      if (cfConfig.getConnectorNames() == null || cfConfig.getConnectorNames().size() == 0) {
         throw ActiveMQJMSServerBundle.BUNDLE.noConnectorNameOnCF();
      }

      TransportConfiguration[] configs = new TransportConfiguration[cfConfig.getConnectorNames().size()];

      int count = 0;
      for (String name : cfConfig.getConnectorNames()) {
         TransportConfiguration connector = server.getConfiguration().getConnectorConfigurations().get(name);
         if (connector == null) {
            throw ActiveMQJMSServerBundle.BUNDLE.noConnectorNameConfiguredOnCF(name);
         }
         correctInvalidNettyConnectorHost(connector);
         configs[count++] = connector;
      }

      if (cfConfig.isHA()) {
         cf = ActiveMQJMSClient.createConnectionFactoryWithHA(cfConfig.getFactoryType(), configs);
      } else {
         cf = ActiveMQJMSClient.createConnectionFactoryWithoutHA(cfConfig.getFactoryType(), configs);
      }
   }

   cf.setClientID(cfConfig.getClientID());
   cf.setClientFailureCheckPeriod(cfConfig.getClientFailureCheckPeriod());
   cf.setConnectionTTL(cfConfig.getConnectionTTL());
   cf.setCallTimeout(cfConfig.getCallTimeout());
   cf.setCallFailoverTimeout(cfConfig.getCallFailoverTimeout());
   cf.setCacheLargeMessagesClient(cfConfig.isCacheLargeMessagesClient());
   cf.setMinLargeMessageSize(cfConfig.getMinLargeMessageSize());
   cf.setConsumerWindowSize(cfConfig.getConsumerWindowSize());
   cf.setConsumerMaxRate(cfConfig.getConsumerMaxRate());
   cf.setConfirmationWindowSize(cfConfig.getConfirmationWindowSize());
   cf.setProducerWindowSize(cfConfig.getProducerWindowSize());
   cf.setProducerMaxRate(cfConfig.getProducerMaxRate());
   cf.setBlockOnAcknowledge(cfConfig.isBlockOnAcknowledge());
   cf.setBlockOnDurableSend(cfConfig.isBlockOnDurableSend());
   cf.setBlockOnNonDurableSend(cfConfig.isBlockOnNonDurableSend());
   cf.setAutoGroup(cfConfig.isAutoGroup());
   cf.setPreAcknowledge(cfConfig.isPreAcknowledge());
   cf.setConnectionLoadBalancingPolicyClassName(cfConfig.getLoadBalancingPolicyClassName());
   cf.setTransactionBatchSize(cfConfig.getTransactionBatchSize());
   cf.setDupsOKBatchSize(cfConfig.getDupsOKBatchSize());
   cf.setUseGlobalPools(cfConfig.isUseGlobalPools());
   cf.setScheduledThreadPoolMaxSize(cfConfig.getScheduledThreadPoolMaxSize());
   cf.setThreadPoolMaxSize(cfConfig.getThreadPoolMaxSize());
   cf.setRetryInterval(cfConfig.getRetryInterval());
   cf.setRetryIntervalMultiplier(cfConfig.getRetryIntervalMultiplier());
   cf.setMaxRetryInterval(cfConfig.getMaxRetryInterval());
   cf.setReconnectAttempts(cfConfig.getReconnectAttempts());
   cf.setFailoverOnInitialConnection(cfConfig.isFailoverOnInitialConnection());
   cf.setCompressLargeMessage(cfConfig.isCompressLargeMessages());
   cf.setGroupID(cfConfig.getGroupID());
   cf.setProtocolManagerFactoryStr(cfConfig.getProtocolManagerFactoryStr());
   cf.setDeserializationBlackList(cfConfig.getDeserializationBlackList());
   cf.setDeserializationWhiteList(cfConfig.getDeserializationWhiteList());
   cf.setInitialMessagePacketSize(cfConfig.getInitialMessagePacketSize());
   cf.setEnable1xPrefixes(cfConfig.isEnable1xPrefixes());
   cf.setEnableSharedClientID(cfConfig.isEnableSharedClientID());
   cf.setUseTopologyForLoadBalancing(cfConfig.getUseTopologyForLoadBalancing());

   return cf;
}