def on_message(self, _, basic_deliver, properties, body):
logger.debug('<STR_LIT>', basic_deliver.delivery_tag, properties.app_id, body)<EOL>try:<EOL><INDENT>decoded = json.loads(body.decode('<STR_LIT>'))<EOL><DEDENT>except ValueError:<EOL><INDENT>logger.warning('<STR_LIT>', body)<EOL><DEDENT>else:<EOL><INDENT>self._handler(decoded)<EOL><DEDENT>self.acknowledge_message(basic_deliver.delivery_tag)<EOL>
Invoked by pika when a message is delivered from RabbitMQ.

        The channel is passed for your convenience. The basic_deliver object
        that is passed in carries the exchange, routing key, delivery tag
        and a redelivered flag for the message. The properties passed in is
        an instance of BasicProperties with the message properties and the
        body is the message that was sent.

        We'll json-decode the message body, and if that succeeds, call the
        handler that was given to us. Messages that contain invalid json
        will be discarded.

        :type _: pika.channel.Channel
        :type basic_deliver: pika.Spec.Basic.Deliver
        :type properties: pika.Spec.BasicProperties
        :type body: str|unicode