def send_message()

in backend-printing/helper/storage.py [0:0]


    def send_message(self, message):
        """Send a message to the queue

        Args:
            message (string): message to send
        """
        try:
            encoded_message = json.dumps(message).encode("utf-8")
            # if message size is greater than 60KB, store it in blob
            # and send the blob url in the message
            if len(encoded_message) > 60 * 1024:
                blob_guid = str(uuid4())
                blob_url = self._store_document_to_blob(blob_guid, message)
                encoded_message = json.dumps(
                    {"blob_guid": blob_guid, "blob_url": blob_url}
                ).encode("utf-8")
            send_message_response = self.storage_queue_client.send_message(
                content=encoded_message,
                time_to_live=MESSAGE_EXPIRY_TIME,
            )
            return send_message_response
        except Exception as e:
            raise Exception(f"Error occurred while sending message: {e}")