Application packages can contain Java components to be run in container clusters. The most common component types are:
Components are constructed by dependency injection and are reloaded safely on deployment without restarts. See the container documentation for more details.
See the sample applications in getting started, to find examples of applications containing Java components. Also see troubleshooting.
The development cycle consists of creating the component, deploying the application package to Vespa, writing tests, and iterating. These steps refer to files in album-recommendation-java:
Build |
All the Vespa sample applications use the bundle plugin to build the components. | |
---|---|---|
Configure |
A key Vespa feature is code and configuration consistency, deployed using an application package. This ensures that code and configuration is in sync, and loaded atomically when deployed. This is done by generating config classes from config definition files. In Vespa and application code, configuration is therefore accessed through generated config classes.
The Maven target After generating config classes, they will resolve in tools like IntelliJ IDEA. | |
Tests |
Examples unit tests are found in
MetalSearcherTest.java.
Read more in unit testing. |
To debug a Searcher / Document Processor / Component running in the container, set up a remote debugging configuration in the IDEA - IntelliJ example:
+
to add a new configuration.
<container id="default" version="1.0">
<nodes>
<jvm options="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005" />
$ docker run --detach --name vespa --hostname vespa-container \
--publish 127.0.0.1:8080:8080 --publish 127.0.0.1:19071:19071 --publish 127.0.0.1:5005:5005 \
vespaengine/vespa