def __init__(self): siteMapping.reload() # MQ connection self.connection = None self.q = queue.Queue() self.RMQ_parameters = self.get_RMQ_connection_parameters() self.es_index_prefix = os.environ.get("ES_INDEX_PREFIX", "") self.aLotOfData = [] self.last_flush = time.time() self.last_headers = None self.es_conn = None self.msg_counter = 0
import Queue import socket import time import threading import copy import json from datetime import datetime import stomp import siteMapping import tools topic = '/topic/netflow.lhcopn' siteMapping.reload() conns = [] class MyListener(object): def on_message(self, headers, message): q.put(message) def on_error(self, headers, message): print('received an error %s' % message) def on_heartbeat_timeout(self): print('AMQ - lost heartbeat. Needs a reconnect!') connectToAMQ()