Skip to content

Commit

Permalink
Merge pull request vert-x3#20 from Gsantomaggio/vertx-rabbitmq-client-19
Browse files Browse the repository at this point in the history
add connection parameters
  • Loading branch information
poiuytrez authored Aug 16, 2016
2 parents 87f4d95 + 6d7f302 commit b2a7e53
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/main/java/io/vertx/rabbitmq/impl/RabbitMQClientImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ private <T> void forChannel(Handler<AsyncResult<T>> resultHandler, ChannelHandle

channel = connection.createChannel();
} catch (IOException e) {
log.debug("create channel error");
log.debug("create channel error");
resultHandler.handle(Future.failedFuture(e));
}
}
Expand Down Expand Up @@ -345,6 +345,7 @@ public void shutdownCompleted(ShutdownSignalException cause) {
log.info("RabbitMQ connection shutdown! The client will attempt to reconnect automatically", cause);
}


private static Connection newConnection(JsonObject config) throws IOException, TimeoutException {
ConnectionFactory cf = new ConnectionFactory();
String uri = config.getString("uri");
Expand Down Expand Up @@ -372,13 +373,40 @@ private static Connection newConnection(JsonObject config) throws IOException, T
if (port != null) {
cf.setPort(port);
}

String virtualHost = config.getString("virtualHost");
if (virtualHost != null) {
cf.setVirtualHost(virtualHost);
}
}

// Connection timeout
Integer connectionTimeout = config.getInteger("connectionTimeout");
if (connectionTimeout != null) {
cf.setConnectionTimeout(connectionTimeout);
}

Integer requestedHeartbeat = config.getInteger("requestedHeartbeat");
if (requestedHeartbeat != null) {
cf.setRequestedHeartbeat(requestedHeartbeat);
}

Integer handshakeTimeout = config.getInteger("handshakeTimeout");
if (handshakeTimeout != null) {
cf.setHandshakeTimeout(handshakeTimeout);
}


Integer requestedChannelMax = config.getInteger("requestedChannelMax");
if (requestedChannelMax != null) {
cf.setRequestedChannelMax(requestedChannelMax);
}

Integer networkRecoveryInterval = config.getInteger("networkRecoveryInterval");
if (networkRecoveryInterval != null) {
cf.setNetworkRecoveryInterval(networkRecoveryInterval);
}

//TODO: Support other configurations

// Automatic recovery of connections/channels/etc.
Expand Down

0 comments on commit b2a7e53

Please sign in to comment.