How can a Java program tell which "backend" it is when using AppEngine Modules?

105 views Asked by At

It used to be that a Java program running on AppEngine could tell what backend it was by calling:

BackendService backendservice = BackendServiceFactory.getBackendService();
String currentbackend = backendservice.getCurrentBackend();

The BackendService has been deprecated with the advent of "modules" but you can still deploy an app under multiple "named versions" to get the same effect should you not want to move on to full modules.

How though, using this new system, should a program determine which backend/version it is without using the deprecated code?

1

There are 1 answers

1
Andrei Volgin On BEST ANSWER

You can use

ModulesService modulesService = ModulesServiceFactory.getModulesService();

modulesService.getCurrentModule();
modulesService.getCurrentVersion();
modulesService.getCurrentInstanceId();