Making more things configurable through the realtime.spec file.

This commit is contained in:
Stefán Freyr Stefánsson 2013-07-13 16:49:39 +00:00
parent fc74333a28
commit 4d998e4c27
2 changed files with 13 additions and 3 deletions

View File

@ -18,7 +18,11 @@
"consumerProps" : { "username": "test-dude",
"password": "test-word",
"virtualHost": "test-vhost",
"host": "localhost"
"host": "localhost",
"durable": "true",
"exclusive": "false",
"autoDelete": "false",
"audoAck": "false"
},
"queue" : "druidtest",
"exchange": "test-exchange",

View File

@ -61,12 +61,17 @@ public class RabbitMQFirehoseFactory implements FirehoseFactory{
factory.setPassword(consumerProps.getProperty("password", factory.getPassword()));
factory.setVirtualHost(consumerProps.getProperty("virtualHost", factory.getVirtualHost()));
boolean durable = Boolean.valueOf(consumerProps.getProperty("durable", "false"));
boolean exclusive = Boolean.valueOf(consumerProps.getProperty("exclusive", "false"));
boolean autoDelete = Boolean.valueOf(consumerProps.getProperty("autoDelete", "false"));
boolean autoAck = Boolean.valueOf(consumerProps.getProperty("autoAck", "true"));
final Connection connection = factory.newConnection();
final Channel channel = connection.createChannel();
channel.queueDeclare(queue, true, false, false, null);
channel.queueDeclare(queue, durable, exclusive, autoDelete, null);
channel.queueBind(queue, exchange, routingKey);
final QueueingConsumer consumer = new QueueingConsumer(channel);
channel.basicConsume(queue, false, consumer);
channel.basicConsume(queue, autoAck, consumer);
return new Firehose(){
@ -103,6 +108,7 @@ public class RabbitMQFirehoseFactory implements FirehoseFactory{
}
// Shouldn't ever get here but in case we'll assume there is no more stuff.
log.wtf("We shouldn't be here!");
return false;
}