def on_message_callback()

in provisioningHandler.py [0:0]


    def on_message_callback(self, payload):
        """ Callback Message handler responsible for workflow routing of msg responses from provisioning services.
        
        Arguments:
            payload {bytes} -- The response message payload.
        """
        json_data = json.loads(payload)
        # A response has been recieved from the service that contains certificate data. 
        if 'certificateId' in json_data:
            self.logger.info('Success. Saving keys to the device! ')
            print('Success. Saving keys to the device! ')
            self.assemble_certificates(json_data)
        
        # A response contains acknowledgement that the provisioning template has been acted upon.
        elif 'deviceConfiguration' in json_data:
            if self.isRotation:
                self.logger.info('Activation Complete ')
                print('Activation Complete')
            else:
                self.logger.info('Certificate Activated and device {} associated '.format(json_data['thingName']))
                print('Certificate Activated and device {} associated '.format(json_data['thingName']))
                self.primary_MQTTClient.disconnect()
                #time.sleep(60)
                
            self.validate_certs()
        elif 'service_response' in json_data:
            self.logger.info(json_data)
            print('Successfully connected with production certificates ')
        else:
            self.logger.info(json_data)