mirror of https://github.com/apache/druid.git
Implemented a better query.body for the test I'm using. Added a shutdown listener to the connection and channel to get a notification when they are closed. Question remains whether the connection should be re-established when that happens.
This commit is contained in:
parent
4d998e4c27
commit
13328a6b36
|
@ -1,19 +1,12 @@
|
|||
{
|
||||
"queryType": "groupBy",
|
||||
"dataSource": "randSeq",
|
||||
"dataSource": "rabbitmqtest",
|
||||
"granularity": "all",
|
||||
"dimensions": [],
|
||||
"aggregations": [
|
||||
{ "type": "count", "name": "rows" },
|
||||
{ "type": "doubleSum", "fieldName": "events", "name": "e"},
|
||||
{ "type": "doubleSum", "fieldName": "outColumn", "name": "randomNumberSum"}
|
||||
{"type": "longSum", "name": "imps", "fieldName": "impressions"},
|
||||
{"type": "doubleSum", "name": "wp", "fieldName": "wp"}
|
||||
],
|
||||
"postAggregations":[
|
||||
{ "type":"arithmetic",
|
||||
"name":"avg_random",
|
||||
"fn":"/",
|
||||
"fields":[ {"type":"fieldAccess","name":"randomNumberSum","fieldName":"randomNumberSum"},
|
||||
{"type":"fieldAccess","name":"rows","fieldName":"rows"} ]}
|
||||
],
|
||||
"intervals":["2012-10-01T00:00/2020-01-01T00"]
|
||||
"intervals": ["2010-01-01T00:00/2020-01-01T00"]
|
||||
}
|
||||
|
|
|
@ -72,6 +72,20 @@ public class RabbitMQFirehoseFactory implements FirehoseFactory{
|
|||
channel.queueBind(queue, exchange, routingKey);
|
||||
final QueueingConsumer consumer = new QueueingConsumer(channel);
|
||||
channel.basicConsume(queue, autoAck, consumer);
|
||||
channel.addShutdownListener(new ShutdownListener() {
|
||||
@Override
|
||||
public void shutdownCompleted(ShutdownSignalException cause) {
|
||||
log.warn(cause, "Channel closed!");
|
||||
//TODO: should we re-establish the connection here?
|
||||
}
|
||||
});
|
||||
connection.addShutdownListener(new ShutdownListener() {
|
||||
@Override
|
||||
public void shutdownCompleted(ShutdownSignalException cause) {
|
||||
log.warn(cause, "Connection closed!");
|
||||
//TODO: should we re-establish the connection here?
|
||||
}
|
||||
});
|
||||
|
||||
return new Firehose(){
|
||||
|
||||
|
@ -148,6 +162,7 @@ public class RabbitMQFirehoseFactory implements FirehoseFactory{
|
|||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
log.info("Closing connection to RabbitMQ");
|
||||
channel.close();
|
||||
connection.close();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue