////
This guide is maintained in the main Quarkus repository
and pull requests should be submitted there:
https://github.com/quarkusio/quarkus/tree/main/docs/src/main/asciidoc
////
= Dev Services for Apicurio Registry

include::./attributes.adoc[]

If the `quarkus-apicurio-registry-avro` extension is present, Dev Services for Apicurio Registry automatically starts an Apicurio Registry instance in dev mode and when running tests.
Also, all Kafka channels in SmallRye Reactive Messaging are automatically configured to use this registry.
(This automatic configuration of course only applies to serializers and deserializers from the Apicurio Registry Avro library.)

== Enabling / Disabling Dev Services for Apicurio Registry

Dev Services for Apicurio Registry is automatically enabled unless:

- `quarkus.apicurio-registry.devservices.enabled` is set to `false`
- `mp.messaging.connector.smallrye-kafka.apicurio.registry.url` is configured
- all the Reactive Messaging Kafka channels have the `apicurio.registry.url` attribute set

Dev Services for Apicurio Registry relies on Docker to start the registry.
If your environment does not support Docker, you will need to start the registry manually, or use an already running registry.
You can configure the registry URL for all Kafka channels in SmallRye Reactive Messaging with a single property:

[source,properties]
----
mp.messaging.connector.smallrye-kafka.apicurio.registry.url=http://localhost:8081/apis/registry/v2
----

== Shared registry

Most of the time you need to share the registry between applications.
Dev Services for Apicurio Registry implements a _service discovery_ mechanism for your multiple Quarkus applications running in _dev_ mode to share a single registry.

NOTE: Dev Services for Apicurio Registry starts the container with the `quarkus-dev-service-apicurio-registry` label which is used to identify the container.

If you need multiple (shared) registries, you can configure the `quarkus.apicurio-registry.devservices.service-name` attribute and indicate the registry 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 `apicurio-registry`.

Sharing is enabled by default in dev mode, but disabled in test mode.
You can disable the sharing with `quarkus.apicurio-registry.devservices.shared=false`.

== Setting the port

By default, Dev Services for Apicurio Registry picks a random port and configures the application.
You can set the port by configuring the `quarkus.apicurio-registry.devservices.port` property.

Note that the Kafka channels in SmallRye Reactive messaging are automatically configured with the chosen port.

== Configuring the image

Dev Services for Apicurio Registry uses `apicurio/apicurio-registry-mem` images.
You can select any 2.x version from https://hub.docker.com/r/apicurio/apicurio-registry-mem:

[source, properties]
----
quarkus.apicurio-registry.devservices.image-name=apicurio/apicurio-registry-mem:latest-snapshot
----
