feroze
feroze

Reputation: 7594

How to lease tasks from a pull-queue when running in dev_appserver?

Is there a way to lease tasks from a pull-queue when running the application locally using dev_appserver?

More Info:

I have a GAE app that uses pull queues. I need to lease tasks from that queue from a different service written in java. I am running the GAE app using dev_appserver on my machine. How do I lease tasks from this queue? The Docs on GAE state that I have to lease tasks by hitting a REST endpoint on https://www.googleapis.com/taskqueue/v1beta1/projects/taskqueues. This URI is not exposed by my machine.

Upvotes: 3

Views: 570

Answers (2)

Neil
Neil

Reputation: 6039

This is how you will get the backend URL , no mater its cloud or local devserver

    BackendService backendsApi = BackendServiceFactory.getBackendService();
    log.info( "Well we have a backend {}", backendsApi.getBackendAddress( "backendName" ) );

Upvotes: 0

rbanffy
rbanffy

Reputation: 2521

If the development server doesn't expose the endpoint, you'll have to build a minimal implementation of it yourself in order to test it.

But maybe a better approach would be to build a mock implementation the Java service could connect to (and be tested against) instead of requiring a running dev_appserver instance. This also has the advantage of keeping your implementation simple, as it doesn't have to think much and actually manage queues, but only respond according to what the Google endpoint would. You could also simulate any error conditions you experience from Google to see if your Java services can deal with those situations correctly.

Upvotes: 1

Related Questions