当前位置: 首页>>代码示例>>Java>>正文


Java ConnectionFactory.setNetworkRecoveryInterval方法代码示例

本文整理汇总了Java中com.rabbitmq.client.ConnectionFactory.setNetworkRecoveryInterval方法的典型用法代码示例。如果您正苦于以下问题:Java ConnectionFactory.setNetworkRecoveryInterval方法的具体用法?Java ConnectionFactory.setNetworkRecoveryInterval怎么用?Java ConnectionFactory.setNetworkRecoveryInterval使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.rabbitmq.client.ConnectionFactory的用法示例。


在下文中一共展示了ConnectionFactory.setNetworkRecoveryInterval方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import com.rabbitmq.client.ConnectionFactory; //导入方法依赖的package包/类
static ConnectionProvider create(final RabbitMqConfig config, final DefaultSslConfigurator sslConfigurator) {
    final ConnectionFactory connectionFactory = new ConnectionFactory();
    connectionFactory.setUsername(config.username());
    connectionFactory.setPassword(config.password());
    connectionFactory.setVirtualHost(config.virtualHost());
    connectionFactory.setAutomaticRecoveryEnabled(config.networkRecoveryEnabled());
    connectionFactory.setTopologyRecoveryEnabled(config.topologyRecoveryEnabled());
    connectionFactory.setConnectionTimeout((int) config.connectionTimeout().toMillis());
    connectionFactory.setHandshakeTimeout((int) config.handshakeTimeout().toMillis());
    connectionFactory.setShutdownTimeout((int) config.shutdownTimeout().toMillis());
    connectionFactory.setNetworkRecoveryInterval(config.networkRecoveryInterval().toMillis());
    connectionFactory.setRequestedHeartbeat((int) config.heartbeat().getSeconds());
    connectionFactory.setRequestedChannelMax(config.channelLimit());
    connectionFactory.setRequestedFrameMax(config.frameSizeLimit());
    if (config.nonBlockingIoEnabled()) {
        connectionFactory.useNio();
    } else {
        connectionFactory.useBlockingIo();
    }
    if (config.sslEnabled()) {
        sslConfigurator.configure(connectionFactory, config);
    }
    return new RabbitConnectionProvider(config, connectionFactory);
}
 
开发者ID:FinderSystems,项目名称:Elmer,代码行数:25,代码来源:RabbitConnectionProvider.java

示例2: registerFactory

import com.rabbitmq.client.ConnectionFactory; //导入方法依赖的package包/类
/**
 * 注册主机
 * 
 * @param hostPort
 */
private synchronized static void registerFactory(String hostPort) {
	if (hostPort == null || hostPort.isEmpty())
		return;
	if (!hostPort.contains(":"))
		return;

	String[] params = hostPort.split(":");
	if (params.length != 2) {
		logger.warn("hostPort illegal, length is not 2");
		return;
	}
	logger.info("registering new factory [" + hostPort + "] ...");
	ConnectionFactory factory = new ConnectionFactory();
	factory.setHost(params[0]);
	factory.setPort(Integer.valueOf(params[1]));
	factory.setAutomaticRecoveryEnabled(automaticRecovery);
	factory.setNetworkRecoveryInterval(networkRecoveryInterval);
	factory.setUsername(userName);
	factory.setPassword(password);
	ConnectionFactoryManager.getInstance().register(hostPort, factory);
}
 
开发者ID:WengShengyuan,项目名称:rabbit-mq-client,代码行数:27,代码来源:PooledConnectionFactory.java

示例3: createConnectionFactory

import com.rabbitmq.client.ConnectionFactory; //导入方法依赖的package包/类
private ConnectionFactory createConnectionFactory() throws IOException {
    ConnectionFactory factory = new ConnectionFactory();
    factory.setUsername(this.config.getUsername());
    factory.setPassword(this.config.getPassword());
    factory.setVirtualHost(this.config.getVirtualHost());

    factory.setAutomaticRecoveryEnabled(true);
    factory.setConnectionTimeout(this.config.getConnectionTimeout());
    factory.setNetworkRecoveryInterval(this.config.getNetworkRecoveryInterval());

    if (this.threadFactory != null) {
        factory.setThreadFactory(this.threadFactory);
    }

    return factory;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:17,代码来源:QueueClient.java

示例4: createFactoryFor

import com.rabbitmq.client.ConnectionFactory; //导入方法依赖的package包/类
public ConnectionFactory createFactoryFor(final RabbitMQEndpoint endpoint) {
    ConnectionFactory factory = new ConnectionFactory();
    factory.setUsername(endpoint.getUsername());
    factory.setPassword(endpoint.getPassword());
    factory.setVirtualHost(endpoint.getVhost());
    factory.setHost(endpoint.getHostname());
    factory.setPort(endpoint.getPortNumber());
    if (endpoint.getClientProperties() != null) {
        factory.setClientProperties(endpoint.getClientProperties());
    }
    factory.setConnectionTimeout(endpoint.getConnectionTimeout());
    factory.setRequestedChannelMax(endpoint.getRequestedChannelMax());
    factory.setRequestedFrameMax(endpoint.getRequestedFrameMax());
    factory.setRequestedHeartbeat(endpoint.getRequestedHeartbeat());
    if (endpoint.getSslProtocol() != null) {
        try {
            if (endpoint.getSslProtocol().equals("true")) {
                factory.useSslProtocol();
            } else if (endpoint.getTrustManager() == null) {
                factory.useSslProtocol(endpoint.getSslProtocol());
            } else {
                factory.useSslProtocol(endpoint.getSslProtocol(), endpoint.getTrustManager());
            }
        } catch (NoSuchAlgorithmException | KeyManagementException e) {
            throw new IllegalArgumentException("Invalid sslProtocol " + endpoint.getSslProtocol(), e);
        }
    }
    if (endpoint.getAutomaticRecoveryEnabled() != null) {
        factory.setAutomaticRecoveryEnabled(endpoint.getAutomaticRecoveryEnabled());
    }
    if (endpoint.getNetworkRecoveryInterval() != null) {
        factory.setNetworkRecoveryInterval(endpoint.getNetworkRecoveryInterval());
    }
    if (endpoint.getTopologyRecoveryEnabled() != null) {
        factory.setTopologyRecoveryEnabled(endpoint.getTopologyRecoveryEnabled());
    }
    return factory;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:39,代码来源:RabbitMQConnectionFactorySupport.java

示例5: getConnectionFactory

import com.rabbitmq.client.ConnectionFactory; //导入方法依赖的package包/类
/**
 *
 * @return Connection Factory for RMQ
 * @throws URISyntaxException, NoSuchAlgorithmException, KeyManagementException if Malformed URI has been passed
 */
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;
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:48,代码来源:RMQConnectionConfig.java

示例6: RmqChannel

import com.rabbitmq.client.ConnectionFactory; //导入方法依赖的package包/类
/**
 * initialize rabbit mq listener
 * 
 * @param builder properties to init channel.
 * @throws Exception if failed.
 */
public RmqChannel(Rmq.Builder builder) throws Exception {

  final ConnectionFactory factory = new ConnectionFactory();

  factory.setHost(builder.host());

  if (builder.port() != -1) {
    factory.setPort(builder.port());
  }

  factory.setConnectionTimeout(builder.timeout());

  factory.setAutomaticRecoveryEnabled(builder.autoRecovery());
  factory.setNetworkRecoveryInterval(builder.networkRecoveryInterval());

  if (builder.credentials() != null && builder.credentials() instanceof BasicCredentials) {
    BasicCredentials basic = (BasicCredentials) builder.credentials();
    factory.setUsername(basic.username());
    factory.setPassword(basic.password());
  }


  this.connection = factory.newConnection();
  this.channel = connection.createChannel();

}
 
开发者ID:scalecube,项目名称:RabbitMQ-gateway,代码行数:33,代码来源:RmqChannel.java


注:本文中的com.rabbitmq.client.ConnectionFactory.setNetworkRecoveryInterval方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。