(self, config=None)
Create a new instance of rmqHandler class
Create a new instance of rmqHandler class
Create a new instance of rmqHandler class
def __init__(self, config=None):
        """
          Create a new instance of rmqHandler class
        """

        # Initialize Handler
        Handler.__init__(self, config)

        # Initialize Data
        self.connection = None
        self.channel = None

        # Initialize Options
        self.server = self.config.get('server', '127.0.0.1')
        self.port = int(self.config.get('port', 5672))
        self.topic_exchange = self.config.get('topic_exchange', 'diamond')
        self.vhost = self.config.get('vhost', '')
        self.user = self.config.get('user', 'guest')
        self.password = self.config.get('password', 'guest')
        self.routing_key = self.config.get('routing_key', 'metric')
        self.custom_routing_key = self.config.get(
            'custom_routing_key', 'diamond')

        if not pika:
            self.log.error('pika import failed. Handler disabled')
            self.enabled = False
            return

        # Create rabbitMQ topic exchange and bind
        try:
            self._bind()
        except pika.exceptions.AMQPConnectionError:
            self.log.error('Failed to bind to rabbitMQ topic exchange')
def __init__ ( self , config = None ) : # Initialize Handler Handler . __init__ ( self , config ) # Initialize Data self . connection = None self . channel = None # Initialize Options self . server = self . config . get ( 'server' , '127.0.0.1' ) self . port = int ( self . config . get ( 'port' , 5672 ) ) self . topic_exchange = self . config . get ( 'topic_exchange' , 'diamond' ) self . vhost = self . config . get ( 'vhost' , '' ) self . user = self . config . get ( 'user' , 'guest' ) self . password = self . config . get ( 'password' , 'guest' ) self . routing_key = self . config . get ( 'routing_key' , 'metric' ) self . custom_routing_key = self . config . get ( 'custom_routing_key' , 'diamond' ) if not pika : self . log . error ( 'pika import failed. Handler disabled' ) self . enabled = False return # Create rabbitMQ topic exchange and bind try : self . _bind ( ) except pika . exceptions . AMQPConnectionError : self . log . error ( 'Failed to bind to rabbitMQ topic exchange' )