Dev Services for LRA
If the Narayana LRA extension is present (quarkus-narayana-lra), the Dev
Services for Narayana LRA coordinator automatically starts the Narayana LRA
coordinator in dev mode and when running tests. So, you don’t have to start it
manually. The application is also configured automatically to connect to the
coordinator and to make possible for the coordinator to call back the
application.
Because the LRA coordinator needs to call back your application from
the container, we need to expose the application on any host address, not just
localhost. So the Dev Services for LRA coordinator injects
quarkus.http.host=0.0.0.0 into your application configuration which means that
your application is accessible from any machine running in the same network as
your development machine. This is a potential security risk, so use the LRA
Dev Services only if you are sure that it is safe.
|
Enabling / Disabling Dev Services for LRA
Dev Services for LRA is automatically enabled unless:
-
quarkus.lra.devservices.enabledis set tofalse -
the
quarkus.lra.coordinator-urlis configured
Dev Services for LRA relies on Docker or Podman to start the coordinator. If
your environment does not support Docker, you will need to start the coordinator
manually, or connect to an already running coordinator. You can configure the
coordinator URL using quarkus.lra.coordinator-url.
Sharing LRA coordinator
Most likely you need to share the LRA coordinator between applications. The Dev Services for LRA coordinator implements a service discovery mechanism for your multiple Quarkus applications running in dev mode to share a single coordinator.
Dev Services for LRA starts the container with the
quarkus-dev-service-lra-coordinator label which is used to identify the
container.
|
If you need multiple (shared) coordinators, you can configure the
quarkus.lra.devservices.service-name attribute and indicate the coordinator
name. It looks for a container with the same value, or starts a new one if none
can be found. The default service name is lra-coordinator.
Sharing is enabled by default in dev mode, but disabled in test mode.
You can disable the sharing with quarkus.lra.devservices.shared=false.
Setting the port
By default, Dev Services for LRA picks a random port on which to run the LRA
coordinator. You can set the port by configuring the
quarkus.lra.devservices.port property. The connection property
quarkus.lra.coordinator-url is automatically configured with the chosen port.
Configuring the image
The default image for the LRA coordinator is quay.io/jbosstm/lra-coordinator.
You can configure the image used by Dev Services for LRA coordinator using the
quarkus.lra.devservices.image-name property. You can browse the available
images at https://quay.io/repository/jbosstm/lra-coordinator?tab=tags.
Compose
The LRA Dev Services supports Compose Dev Services.
It relies on a compose-devservices.yml, such as:
name: <application name>
services:
mongo:
image: quay.io/jbosstm/lra-coordinator:7.2.2.Final-3.24.4
ports:
- "8080"
Configuration reference
Configuration property fixed at build time - All other configuration properties are overridable at runtime
Configuration property |
Type |
Default |
|---|---|---|
If Dev Services for the LRA coordinator has been explicitly enabled or disabled. For the LRA coordinator, the Dev Services is disabled if this property is false or if the Environment variable: Show more |
boolean |
|
Optional fixed port the Dev Services will listen to. If not defined, the port will be chosen randomly. Environment variable: Show more |
int |
|
Optional override of the LRA coordinator container image to use. Environment variable: Show more |
string |
|
Indicates if the LRA coordinator managed by Quarkus Dev Services is shared. When shared, Quarkus looks for running containers using label-based service discovery. If a matching container is found, it is used, and so a second one is not started. Otherwise, Dev Services for LRA coordinator starts a new container. The discovery uses the Container sharing is only used in dev mode. Environment variable: Show more |
boolean |
|
The value of the This property is used when you need multiple shared LRA coordinators. Environment variable: Show more |
string |
|
Environment variables that are passed to the container. Environment variable: Show more |
Map<String,String> |
|
Whether to log the warning messages about the LRA Dev Services. Defaults to Environment variable: Show more |
boolean |
|