google-app-engine


How to send custom data with Cloud Pub/Sub when GCS object is uploaded via a Signed URL


I was able to set up Google Cloud Storage Cloud Pub/Sub notifications using:
gsutil notification create -t [TOPIC_NAME] -m my-key:my-value -f json gs://[BUCKET_NAME]
My App Engine servlet correctly gets a message every time an object is uploaded to GCS. I upload my object to GCS with a Signed URL.
However, I'm not sure how to set custom key-value pairs from my client when uploading an object with the Signed URL. The above gsutil command lets you set a key:value pair but it hard-codes it so that is not useful. In my client I want to set some key:value pair like user : some-user so then in my servlet I can do some extra App Engine stuff like write to a database.
I tried uploading some headers in the metadata tag as shown here but getting those headers from the HttpServletRequest in the servlet didn't seem to work.
Also, how would I sent the subscriptionUniqueToken as well, since there is no explanation on how to do that.
Note: using Java
The notion of a unique token is no longer necessary in most cases. Object change notifications offered them because they worked by sending unauthenticated HTTPS calls to a configurable endpoint. If that endpoint were discovered, a malicious user could also send such calls. However, Cloud Pub/Sub notifications publish messages to a topic as a known service account, and so long as no malicious third party is also granted publishing permission to that topic, they cannot interfere. If you want, you can include a unique token as a second protection mechanism, but it's generally not necessary.
"Client tokens" are a feature specific to Object Change Notifications. The equivalent with Cloud Pub/Sub integration are "custom_attributes", user-specified properties of a notification config that are attached as extra attributes to each notification. You could add a "unique_token" attribute and attach a value, if you wish.
When using signed URLs, setting custom metadata is done with HTTP headers beginning x-goog-meta-. For example, x-goog-meta-stuff: Foo will create a custom attribute pair "stuff: Foo".

Related Links

unable to deploy after upgrading to 1.7.4
Model.get(list_of_keys) in a transaction, filtering a single entity group instead of throwing BadRequestError
Google app engine and JPA with Eclipse plug-in
Many-To-Many Relationships in Google App Engine Datastore (ndb)
Is it possible to run Google Omaha on Google App Engine?
Loading request start-up time variation in google app engine?
GAE 1.7.3 - How to debug appengine-web.xml XML error validating
How to setup data fixtures in Google App Engine for Go
How to write a JDO Query to sort result based on long attribute?
GAE doesn't import gflags
Real time notification system on Google App Engine(GAE)
How can I easily get a list of the indexed terms from a search index in the google appengine full text search api in java?
jpa #version on google appengine with #OneToMany: appengine bug or usage error?
How can I delete old backup via cron?
Error on itext-gae.jar
How to get the original from address in a forwarded message in google app engine?

Categories

HOME
batch-file
wakanda
google-spreadsheet
static
sitecore
seo
big-o
visual-studio-emulator
babeljs
bookmarks
polling
android-json
nstableheaderview
spin
syntaxnet
octave
php-5.6
symmetricds
http-post
esoteric-languages
chargify
solrcloud
google-maps-autocomplete
tiki-wiki
underscore.js
fractions
gp
postback
deltaspike
wacom
android-gridview
keras-layer
raft
modernizr
filesystemwatcher
verifiable-c
ogc
preloader
chronicle-map
launchctl
twilio-click-to-call
x-ray
remedy
excel-dna
baidu
vibrate
usart
pytables
preprocessor
iotivity
lua-telegram-bot
php-socket
cortex-m
toast
mobiledoc-kit
ascii-art
tfs-workitem
coda
atoi
airbrake
mraid
jquery-forms-plugin
android-broadcast
dot.js
gamekit
at-job
crowd
contrast
paw
trdion2011
verold
lnk
wxformbuilder
draw2d-js
menubar
mongohq
scmmanager
dolby-audio-api
font-awesome-4.0.0
virtual-pc
apache-abdera
resource-management
failing-tests
kqueue
denied
xui
socketserver
photolibrary
jqueryform
addchild
filesystemobject
web-application-project
commercial-application

Resources

Encrypt Message