Fire and forget URL

87 views
Skip to first unread message

Ashley Finney

unread,
May 24, 2016, 12:29:17 PM5/24/16
to Google App Engine
In GAE I want to fire a Post message at a URL but I do not want to wait for the response, the call should be as quick and cheap (cpu/memory/cost) as possible.  All I'm doing is using this to send a message to another server.  I don't mind if I lose messages.
Instead of using "appengine/urlfetch" is there another method?

Many thanks.

Chad Vincent

unread,
May 24, 2016, 3:08:21 PM5/24/16
to Google App Engine
There is an Async method on the URLFetchService (in Java, at least) that you can call and just never process the Future.

URLFetchService.fetchAsync(HTTPRequest)

Christian F. Howes

unread,
May 24, 2016, 5:24:33 PM5/24/16
to Google App Engine
note that if you use the urlfetch async (which was going to be my suggestion as well) that you do need to wait at the end of your request handler for the future or the request will be killed if it hasn't completed yet.

Barry Hunter

unread,
May 24, 2016, 5:45:38 PM5/24/16
to google-appengine
Maybe you could use the Task Queue? inserts should generally by quick. 

Then a 'worker' can process tasks in background - performing the actual POSTs 

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/f2962eeb-8fb7-4880-865d-ceaabb93bfc3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Barry Hunter

unread,
May 24, 2016, 5:51:55 PM5/24/16
to google-appengine
Or maybe even use XMPP, to 'chat' with itself. 

The front end just sends a chat message. 

The backend worker subscribes to the channel, and performs the POSTs

Alex Martelli

unread,
May 24, 2016, 5:59:52 PM5/24/16
to google-a...@googlegroups.com
Not sure what advantage you'd envision for XMPP here -- this kind of job (handing out a task to a worker) is exactly what task queues were designed for.

Alex

Barry Hunter

unread,
May 24, 2016, 6:33:06 PM5/24/16
to google-appengine
Possibly no real advantage, just an alternative :)

I suppose, there is a small risk of exceeding the Task Queue storage free quota, but seems unlikely. 

Chad Vincent

unread,
May 25, 2016, 5:03:31 PM5/25/16
to Google App Engine
It's why you don't put any significant payload in the Task.  You put it in a Datastore entity and use the key as the payload.

Or if you really don't care if it fails, put it in Memcache and use the key as the payload.
Reply all
Reply to author
Forward
0 new messages