def process(self, metric): if not pika: return try: self.channel.basic_publish(exchange=self.topic_exchange, routing_key=metric.getPathPrefix(), body=jsonify(metric)) except Exception: # Rough connection re-try logic. self.log.info( "Failed publishing to rabbitMQ. Attempting reconnect") self._bind() sleep(3)
def process(self, metric): if not pika: return try: self.channel.basic_publish( exchange=self.topic_exchange, routing_key=metric.getPathPrefix(), body=jsonify(metric)) except Exception: # Rough connection re-try logic. self.log.info( "Failed publishing to rabbitMQ. Attempting reconnect") self._bind()
def process(self, metric): if self.config.get('output_cloudify_format', False): metric = jsonify(metric) with open(self.config['log_path'], 'a') as f: cPickle.dump(metric, f)