Java Code Examples for com.rabbitmq.client.ConnectionFactory#getUsername()

The following examples show how to use com.rabbitmq.client.ConnectionFactory#getUsername() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RabbitMQClientReconnectTest.java    From vertx-rabbitmq-client with Apache License 2.0 7 votes vote down vote up
@Override
public RabbitMQOptions config() throws Exception {
  RabbitMQOptions cfg = super.config();
  String username;
  String password;
  if (cfg.getUri() != null) {
    ConnectionFactory cf = new ConnectionFactory();
    cf.setUri(cfg.getUri());
    username = cf.getUsername();
    password = cf.getPassword();
  } else {
    username = "guest";
    password = "guest";
  }
  String uri = "amqp://" + username +  ":" + password + "@localhost:" + PROXY_PORT;
  return new RabbitMQOptions()
    .setUri(uri)
    .setConnectionRetries(connectionRetries)
    .setConnectionRetryDelay(connectionRetryDelay);
}
 
Example 2
Source File: BrokerAddresses.java    From rxrabbit with MIT License 5 votes vote down vote up
private void cloneConnectionSettings(ConnectionFactory tmp, URI uri) {
    username = tmp.getUsername();
    password = tmp.getPassword();
    virtualHost = tmp.getVirtualHost();
    host = tmp.getHost();
    port = tmp.getPort();
    scheme = uri.getScheme();
}