Permalink
Browse files

Added support for specifying the RabbitMQ heartbeat

  • Loading branch information...
jplock committed Nov 6, 2012
1 parent ef7ca5b commit 8192caad4a1bbf5a6f3b7fff373f233391259d5d
View
@@ -8,7 +8,8 @@ Octobot:
priority: 5,
workers: 1,
username: cilantro,
- password: burrito
+ password: burrito,
+ heartbeat: 10
}
metrics_port: 1228
@@ -12,6 +12,7 @@
public String username;
public String password;
public String vhost;
+ public Integer heartbeat;
public Queue(String queueType, String queueName, String host, Integer port,
String username, String password) {
@@ -41,6 +42,8 @@ public Queue(HashMap<String, Object> config) {
if (config.get("port") != null)
this.port = Integer.parseInt(((Long) config.get("port")).toString());
+ if (config.get("heartbeat") != null)
+ this.heartbeat = Integer.parseInt(((Long) config.get("heartbeat")).toString());
}
@@ -22,6 +22,9 @@ public RabbitMQ(Queue queue) {
factory.setUsername(queue.username);
factory.setPassword(queue.password);
factory.setVirtualHost(queue.vhost);
+ if (queue.heartbeat != null) {
+ factory.setRequestedHeartbeat(queue.heartbeat);
+ }
}
// Returns a new connection to an AMQP queue.

0 comments on commit 8192caa

Please sign in to comment.