Dev Services for Pulsar
With Quarkus Messaging Pulsar extension (quarkus-messaging-pulsar
)
Dev Services for Pulsar automatically starts a Pulsar broker in dev mode and when running tests.
So, you don’t have to start a broker manually.
The application is configured automatically.
Enabling / Disabling Dev Services for Pulsar
Dev Services for Pulsar is automatically enabled unless:
-
quarkus.pulsar.devservices.enabled
is set tofalse
-
the
pulsar.client.serviceUrl
is configured -
all the Reactive Messaging Pulsar channels have the
serviceUrl
attribute set
Dev Services for Pulsar relies on Docker to start the broker.
If your environment does not support Docker, you will need to start the broker manually, or connect to an already running broker.
You can configure the broker address using pulsar.client.
.
Shared broker
Most of the time you need to share the broker between applications. Dev Services for Pulsar implements a service discovery mechanism for your multiple Quarkus applications running in dev mode to share a single broker.
Dev Services for Pulsar starts the container with the quarkus-dev-service-pulsar label which is used to identify the container.
|
If you need multiple (shared) brokers, you can configure the quarkus.pulsar.devservices.service-name
attribute and indicate the broker 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 pulsar
.
Sharing is enabled by default in dev mode, but disabled in test mode.
You can disable the sharing with quarkus.pulsar.devservices.shared=false
.
Setting the port
By default, Dev Services for Pulsar picks a random port and configures the application.
You can set the port by configuring the quarkus.pulsar.devservices.port
property.
Note that the Pulsar advertised address is automatically configured with the chosen port.
Configuring the image
Dev Services for Pulsar supports the official Apache Pulsar image.
A custom image name can be configured as such:
quarkus.pulsar.devservices.image-name=datastax/lunastreaming-all:2.10_4.7
Configuring the Pulsar broker
You can configure the Dev Services for Pulsar with custom broker configuration.
The following example enables transaction support:
quarkus.pulsar.devservices.broker-config.transaction-coordinator-enabled=true
quarkus.pulsar.devservices.broker-config.system-topic-enabled=true
Configuration reference
Configuration property fixed at build time - All other configuration properties are overridable at runtime
Configuration property |
Type |
Default |
---|---|---|
If Dev Services for Pulsar has been explicitly enabled or disabled. Dev Services are generally enabled by default, unless there is an existing configuration present. For Pulsar, Dev Services starts a broker unless Environment variable: Show more |
boolean |
|
Optional fixed port the dev service will listen to. If not defined, the port will be chosen randomly. Environment variable: Show more |
int |
|
The image to use. Note that only Apache Pulsar images are supported. Specifically, the image repository must end with Environment variable: Show more |
string |
|
Indicates if the Pulsar broker 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 Pulsar 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 Pulsar brokers. Environment variable: Show more |
string |
|
Broker config to set on the Pulsar instance Environment variable: Show more |
Map<String,String> |