Skip to content

Commit

Permalink
Added support for specifying the RabbitMQ heartbeat
Browse files Browse the repository at this point in the history
  • Loading branch information
jplock committed Nov 6, 2012
1 parent ef7ca5b commit 8192caa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion example-config.yml
Expand Up @@ -8,7 +8,8 @@ Octobot:
priority: 5,
workers: 1,
username: cilantro,
password: burrito
password: burrito,
heartbeat: 10
}

metrics_port: 1228
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/urbanairship/octobot/Queue.java
Expand Up @@ -12,6 +12,7 @@ public class Queue {
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) {
Expand Down Expand Up @@ -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());
}


Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/urbanairship/octobot/RabbitMQ.java
Expand Up @@ -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.
Expand Down

0 comments on commit 8192caa

Please sign in to comment.