/** * Sets the virtual host. * * @throws NullPointerException if {@code virtualHost} is null */ public ConnectionOptions withVirtualHost(String virtualHost) { factory.setVirtualHost(Assert.notNull(virtualHost, "virtualHost")); return this; }
/** * Creates a new Options object for the {@code connectionFactory}. * * @throws NullPointerException if {@code connectionFactory} is null */ public ConnectionOptions(ConnectionFactory connectionFactory) { this.factory = Assert.notNull(connectionFactory, "connectionFactory"); withHost(factory.getHost()); }
/** * Sets the {@code sslProtocol} and {@code trustManager} to use. * * @throws NullPointerException if {@code sslProtocol} or {@code trustManager} are null */ public ConnectionOptions withSslProtocol(String sslProtocol, TrustManager trustManager) throws NoSuchAlgorithmException, KeyManagementException { factory.useSslProtocol( Assert.notNull(sslProtocol, "sslProtocol"), Assert.notNull(trustManager, "trustManager")); return this; }
/** * Sets the username. * * @throws NullPointerException if {@code username} is null */ public ConnectionOptions withUsername(String username) { factory.setUsername(Assert.notNull(username, "username")); return this; }
/** * Sets the connection name. Used for logging and consumer thread naming. * * @throws NullPointerException if {@code name} is null */ public ConnectionOptions withName(String name) { this.name = Assert.notNull(name, "name"); return this; }
/** * Sets the SocketFactory to create connections with. * * @throws NullPointerException if {@code hosts} is null */ public ConnectionOptions withSocketFactory(SocketFactory socketFactory) { factory.setSocketFactory(Assert.notNull(socketFactory, "socketFactory")); return this; }
/** * Sets the {@code host}. * * @throws NullPointerException if {@code host} is null */ public ConnectionOptions withHost(String host) { this.host = Assert.notNull(host, "host"); return this; }
/** * Sets the {@code hosts} to attempt connections to, in round-robin order. * * @throws NullPointerException if {@code hosts} is null */ public ConnectionOptions withHosts(String... hosts) { this.addresses = Addresses.addressesFor(Assert.notNull(hosts, "hosts"), 5672); return this; }
/** * Sets the executor used to handle consumer callbacks. The {@code executor} will not be shutdown * when a connection is closed. * * @throws NullPointerException if {@code executor} is null */ public ConnectionOptions withConsumerExecutor(ExecutorService executor) { this.executor = Assert.notNull(executor, "executor"); return this; }
/** * Sets the {@code connectionFactory}. * * @throws NullPointerException if {@code connectionFactory} is null */ public ConnectionOptions withConnectionFactory(ConnectionFactory connectionFactory) { this.factory = Assert.notNull(connectionFactory, "connectionFactory"); return this; }
/** * Sets the client properties. * * @throws NullPointerException if {@code clientProperties} is null */ public ConnectionOptions withClientProperties(Map<String, Object> clientProperties) { factory.setClientProperties(Assert.notNull(clientProperties, "clientProperties")); return this; }
/** * 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; }
/** * Sets the {@code addresses} to attempt connections to, in round-robin order. * * @throws NullPointerException if {@code addresses} is null */ public ConnectionOptions withAddresses(Address... addresses) { this.addresses = Assert.notNull(addresses, "addresses"); return this; }