class RMQConnectionConfig implements Serializable {

	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 | NoSuchAlgorithmException | KeyManagementException e) {
				LOG.error("Failed to parse uri", 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;
	}

	private  RMQConnectionConfig(String host, Integer port, String virtualHost, String username, String password,
								Integer networkRecoveryInterval, Boolean automaticRecovery,
								Boolean topologyRecovery, Integer connectionTimeout, Integer requestedChannelMax,
								Integer requestedFrameMax, Integer requestedHeartbeat);
	private  RMQConnectionConfig(String uri, Integer networkRecoveryInterval, Boolean automaticRecovery,
								Boolean topologyRecovery, Integer connectionTimeout, Integer requestedChannelMax,
								Integer requestedFrameMax, Integer requestedHeartbeat);

}