本文整理了Java中com.rabbitmq.client.Address.getHost()
方法的一些代码示例,展示了Address.getHost()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Address.getHost()
方法的具体详情如下:
包路径:com.rabbitmq.client.Address
类名称:Address
方法名:getHost
暂无
代码示例来源:origin: pmq/rabbitmq-oracle-stored-procedures
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append(this.username);
builder.append('@');
builder.append(this.address.getHost());
builder.append(':');
builder.append(this.address.getPort());
builder.append(this.vhost);
return builder.toString();
}
代码示例来源:origin: spring-cloud/spring-cloud-connectors
private void assertConnectorPropertiesMatchHosts(ConnectionFactory connector, List<String> uriStrings) throws Exception {
Address[] addresses = (Address[]) ReflectionTestUtils.getField(connector, "addresses");
assertNotNull(addresses);
assertEquals(uriStrings.size(), addresses.length);
for (int i = 0; i < uriStrings.size(); i++) {
URI uri = new URI(uriStrings.get(i));
assertEquals(uri.getHost(), addresses[i].getHost());
assertEquals(uri.getPort(), addresses[i].getPort());
}
}
}
代码示例来源:origin: pmq/rabbitmq-oracle-stored-procedures
private static Connection openConnection(FullAddress address) throws IOException {
Connection connection = null;
if (ENABLE_DEBUG) {
System.err.println("trying to connect to " + address);
}
ConnectionFactory connectionFactory = new ConnectionFactory();
connectionFactory.setHost(address.address.getHost());
connectionFactory.setPort(address.address.getPort());
connectionFactory.setUsername(address.username);
connectionFactory.setPassword(address.password);
connectionFactory.setVirtualHost(address.vhost);
connectionFactory.setConnectionTimeout(CONNECTION_OPEN_TIMEOUT);
// try to open the connection
connection = connectionFactory.newConnection();
if (ENABLE_DEBUG) {
System.err.println("connected to " + address);
}
return connection;
}
代码示例来源:origin: spring-projects/spring-amqp
@Test
public void testMultiHost() throws Exception {
CachingConnectionFactory connectionFactory = beanFactory.getBean("multiHost", CachingConnectionFactory.class);
assertNotNull(connectionFactory);
assertEquals(10, connectionFactory.getChannelCacheSize());
DirectFieldAccessor dfa = new DirectFieldAccessor(connectionFactory);
Address[] addresses = (Address[]) dfa.getPropertyValue("addresses");
assertEquals(3, addresses.length);
assertEquals("host1", addresses[0].getHost());
assertEquals(1234, addresses[0].getPort());
assertEquals("host2", addresses[1].getHost());
assertEquals(-1, addresses[1].getPort());
assertEquals("host3", addresses[2].getHost());
assertEquals(4567, addresses[2].getPort());
assertSame(beanFactory.getBean("tf"), TestUtils.getPropertyValue(connectionFactory,
"rabbitConnectionFactory.threadFactory"));
}
内容来源于网络,如有侵权,请联系作者删除!