Interface BackendService (2.0.0)

public interface BackendService

BackendService allows you to retrieve information about backend servers. Backend servers are long running addressable servers that can be used for applications that need to keep persistent state in ram between requests.

This API is deprecated and has been replaced by com.google.appengine.api.modules.ModulesService. Please update your code as soon as possible. See the modules documentation for more information: https://developers.google.com/appengine/docs/java/modules/converting

This API allows you to retrieve information about the backend handling the current request. It also allows you to to get the address of a specific backend instance in such a way that a local server is used during development and a production server is used in production.

Static Fields

BACKEND_ID_ENV_ATTRIBUTE

public static final String BACKEND_ID_ENV_ATTRIBUTE

Environment attribute key where the backend name is stored. See Also: BackendService#getCurrentBackend()

Field Value
TypeDescription
String

DEVAPPSERVER_PORTMAPPING_KEY

public static final String DEVAPPSERVER_PORTMAPPING_KEY
Field Value
TypeDescription
String

INSTANCE_ID_ENV_ATTRIBUTE

public static final String INSTANCE_ID_ENV_ATTRIBUTE

Environment attribute key where the instance id is stored. See Also: BackendService#getCurrentInstance()

Field Value
TypeDescription
String

REQUEST_HEADER_BACKEND_REDIRECT

public static final String REQUEST_HEADER_BACKEND_REDIRECT
Field Value
TypeDescription
String

REQUEST_HEADER_INSTANCE_REDIRECT

public static final String REQUEST_HEADER_INSTANCE_REDIRECT
Field Value
TypeDescription
String

Methods

getBackendAddress(String backend)

public abstract String getBackendAddress(String backend)

Get the address of a specific backend in such a way that a local server is used during development and a production server is used in production.

Parameter
NameDescription
backendString

The name of the backend

Returns
TypeDescription
String

The address of the backend

getBackendAddress(String backend, int instance)

public abstract String getBackendAddress(String backend, int instance)

Get the address of a specific backend instance in such a way that a local instance is used during development and a production server instance is used in production.

Parameters
NameDescription
backendString

The name of the backend

instanceint

The instance id

Returns
TypeDescription
String

The address of the backend instance

getCurrentBackend()

public abstract String getCurrentBackend()

Get the name of the backend handling the current request.

Returns
TypeDescription
String

The name of the backend or null if the request is not handled by a backend.

getCurrentInstance()

public abstract int getCurrentInstance()

Get the instance handling the current request.

Returns
TypeDescription
int

The instance id or -1 if the request is not handled by a backend.