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
Type Description
String

DEVAPPSERVER_PORTMAPPING_KEY

public static final String DEVAPPSERVER_PORTMAPPING_KEY
Field Value
Type Description
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
Type Description
String

REQUEST_HEADER_BACKEND_REDIRECT

public static final String REQUEST_HEADER_BACKEND_REDIRECT
Field Value
Type Description
String

REQUEST_HEADER_INSTANCE_REDIRECT

public static final String REQUEST_HEADER_INSTANCE_REDIRECT
Field Value
Type Description
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
Name Description
backend String

The name of the backend

Returns
Type Description
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
Name Description
backend String

The name of the backend

instance int

The instance id

Returns
Type Description
String

The address of the backend instance

getCurrentBackend()

public abstract String getCurrentBackend()

Get the name of the backend handling the current request.

Returns
Type Description
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
Type Description
int

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