Implementation:Vespa engine Vespa ApplicationId
| Knowledge Sources | |
|---|---|
| Domains | Cloud_API, Application_Identity |
| Last Updated | 2026-02-09 00:00 GMT |
Overview
Immutable value object representing the identity of a Vespa application as a combination of tenant, application, and instance names.
Description
The ApplicationId class is part of the Vespa Cloud public API (ai.vespa.cloud package). It encapsulates the three-part identity of a deployed Vespa application: tenant name, application name, and instance name. This is the fundamental identity primitive used throughout the Vespa Cloud platform to identify which application and instance the code is running as.
The class provides:
- Immutable construction from three string components
- Accessor methods for each component
- Proper equals/hashCode for use in collections
- A toString format of "tenant.application.instance"
Usage
Use this class when you need to programmatically identify which Vespa application you are running in. It is typically obtained via SystemInfo injection in a Vespa Cloud environment, not constructed directly by application code.
Code Reference
Source Location
- Repository: Vespa
- File: hosted-zone-api/src/main/java/ai/vespa/cloud/ApplicationId.java
- Lines: 1-45
Signature
public class ApplicationId {
public ApplicationId(String tenant, String application, String instance)
public String tenant()
public String application()
public String instance()
@Override public boolean equals(Object o)
@Override public int hashCode()
/** Returns the string tenant.application.instance */
@Override public String toString()
}
Import
import ai.vespa.cloud.ApplicationId;
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| tenant | String | Yes | The tenant name |
| application | String | Yes | The application name |
| instance | String | Yes | The instance name |
Outputs
| Name | Type | Description |
|---|---|---|
| tenant() | String | The tenant component of the identity |
| application() | String | The application component of the identity |
| instance() | String | The instance component of the identity |
| toString() | String | Format: "tenant.application.instance" |
Usage Examples
Accessing Application Identity
import ai.vespa.cloud.ApplicationId;
import ai.vespa.cloud.SystemInfo;
import com.yahoo.component.annotation.Inject;
public class MyHandler {
private final ApplicationId appId;
@Inject
public MyHandler(SystemInfo systemInfo) {
this.appId = systemInfo.application();
}
public String getTenantName() {
return appId.tenant();
}
public String getFullId() {
// Returns "myTenant.myApp.default"
return appId.toString();
}
}