apache / pekko-connectors

Apache Pekko Connectors is a Reactive Enterprise Integration library for Java and Scala, based on Reactive Streams and Apache Pekko.
https://pekko.apache.org/
Apache License 2.0
56 stars 27 forks source link

Allow specifying custom metadata when uploading Google Cloud Storage files #656

Open jannisy opened 1 month ago

jannisy commented 1 month ago

The resumableUpload in the Google Cloud Storage connector allows specifying metadata of type Map[String, String] which are added to the uploaded file. As per the GCS documentation, metadata properties like contentType or cacheControl are predefined by GCS.

However, there is also custom metadata, which is arbitrary user-provided key-value pairs. They are sent in the HttpRequest in the same way, but the value is not a string but a json object:

{
    // metadata
    "contentType": "...",
    // custom metadata
    "metadata": {
        "customKey": "customData"
    }
}

However this cannot be modelled currently because metadata is Map[String, String] - the value needs to be specified as Map[String, String] instead of String to handle this.

(According to the documentatoin, GCS should also allow the notation metadata.customKey = customData but this did not work for me when I tried)

pjfanning commented 1 month ago

If the GCS docs say that metadata.customKey is a valid key, I think we really need to track down why that doesn't work.

It is not trivial for us to change the connector to modify the metadata support.

jannisy commented 1 month ago

Yes, makes sense. I will check again if I can find out what's the issue.