本文整理汇总了Java中com.rabbitmq.client.Address.parseAddresses方法的典型用法代码示例。如果您正苦于以下问题:Java Address.parseAddresses方法的具体用法?Java Address.parseAddresses怎么用?Java Address.parseAddresses使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.rabbitmq.client.Address
的用法示例。
在下文中一共展示了Address.parseAddresses方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepare
import com.rabbitmq.client.Address; //导入方法依赖的package包/类
public synchronized void prepare() throws IOException, TimeoutException {
if (rabbitMqChannelPool == null || rabbitMqChannelPool.isClosed()) {
LOGGER.info("Creating RabbitMQ channel pool...");
ConnectionFactory rabbitMqConnectionFactory = createConnectionFactory();
if (rabbitMqConfig.hasAddresses()) {
Address[] addresses = Address.parseAddresses(rabbitMqConfig.getAddresses());
this.rabbitMqChannelFactory = new RabbitMqChannelFactory(rabbitMqConnectionFactory, addresses);
} else {
this.rabbitMqChannelFactory = new RabbitMqChannelFactory(rabbitMqConnectionFactory);
}
this.rabbitMqChannelPool = createRabbitMqChannelPool(rabbitMqChannelFactory);
LOGGER.info("RabbitMQ channel pool was created");
}
}
示例2: setAddresses
import com.rabbitmq.client.Address; //导入方法依赖的package包/类
/**
* If this option is set, camel-rabbitmq will try to create connection based on the setting of option addresses.
* The addresses value is a string which looks like "server1:12345, server2:12345"
*/
public void setAddresses(String addresses) {
Address[] addressArray = Address.parseAddresses(addresses);
if (addressArray.length > 0) {
this.addresses = addressArray;
}
}
示例3: withAddresses
import com.rabbitmq.client.Address; //导入方法依赖的package包/类
/**
* Sets the {@code addresses}.
*
* @param addresses formatted as "host1[:port],host2[:port]", etc.
* @throws NullPointerException if {@code addresses} is null
*/
public ConnectionOptions withAddresses(String addresses) {
this.addresses = Address.parseAddresses(Assert.notNull(addresses, "addresses"));
return this;
}