<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def on_message(self, _, basic_deliver, properties, body):
 """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 """

        logger.debug('Received message # %s from %s: %s', basic_deliver.delivery_tag, properties.app_id, body)
        try:
            decoded = json.loads(body.decode('-utf-8'))
        except ValueError:
            logger.warning('Discarding message containing invalid json: %s', body)
        else:
            self._handler(decoded)

        self.acknowledge_message(basic_deliver.delivery_tag)