String channelID = CommonUtils.getChannelID(monitorID);
if(availableChannels.get(channelID) == null){
try {
//todo need to fix this rather getting it from a file
Connection connection = AMQPConnectionUtil.connect(amqpHosts, connectionName, proxyPath);
Channel channel = null;
channel = connection.createChannel();
availableChannels.put(channelID, channel);
String queueName = channel.queueDeclare().getQueue();
BasicConsumer consumer = new
BasicConsumer(new JSONMessageParser(), localPublisher); // here we use local publisher
channel.basicConsume(queueName, true, consumer);
String filterString = CommonUtils.getRoutingKey(monitorID.getUserName(), hostAddress);
// here we queuebind to a particular user in a particular machine
channel.queueBind(queueName, "glue2.computing_activity", filterString);
logger.info("Using filtering string to monitor: " + filterString);
} catch (IOException e) {
logger.error("Error creating the connection to finishQueue the job:" + monitorID.getUserName());
}
}