public ConnectionFactory getConnectionFactory()

in flink-connector-rabbitmq/src/main/java/org/apache/flink/streaming/connectors/rabbitmq/common/RMQConnectionConfig.java [300:349]


    public ConnectionFactory getConnectionFactory()
            throws URISyntaxException, NoSuchAlgorithmException, KeyManagementException {
        ConnectionFactory factory = new ConnectionFactory();
        if (this.uri != null && !this.uri.isEmpty()) {
            try {
                factory.setUri(this.uri);
            } catch (URISyntaxException e) {
                LOG.error("Failed to parse uri", e);
                throw e;
            } catch (KeyManagementException e) {
                // this should never happen
                LOG.error("Failed to initialize ssl context.", e);
                throw e;
            } catch (NoSuchAlgorithmException e) {
                // this should never happen
                LOG.error("Failed to setup ssl factory.", e);
                throw e;
            }
        } else {
            factory.setHost(this.host);
            factory.setPort(this.port);
            factory.setVirtualHost(this.virtualHost);
            factory.setUsername(this.username);
            factory.setPassword(this.password);
        }

        if (this.automaticRecovery != null) {
            factory.setAutomaticRecoveryEnabled(this.automaticRecovery);
        }
        if (this.connectionTimeout != null) {
            factory.setConnectionTimeout(this.connectionTimeout);
        }
        if (this.networkRecoveryInterval != null) {
            factory.setNetworkRecoveryInterval(this.networkRecoveryInterval);
        }
        if (this.requestedHeartbeat != null) {
            factory.setRequestedHeartbeat(this.requestedHeartbeat);
        }
        if (this.topologyRecovery != null) {
            factory.setTopologyRecoveryEnabled(this.topologyRecovery);
        }
        if (this.requestedChannelMax != null) {
            factory.setRequestedChannelMax(this.requestedChannelMax);
        }
        if (this.requestedFrameMax != null) {
            factory.setRequestedFrameMax(this.requestedFrameMax);
        }

        return factory;
    }