Dev Services para AMQP
O Dev Services for AMQP inicia automaticamente um broker AMQP 1.0 no modo de desenvolvimento e ao executar testes. Portanto, você não precisa iniciar um broker manualmente. A aplicação é configurada automaticamente.
Ativação/desativação do Dev Services para AMQP
O Dev Services para AMQP é ativado automaticamente, a menos que:
-
quarkus.amqp.devservices.enabledé definido comofalse -
the
amqp-hostoramqp-portare configured -
todos os canais AMQP de mensagens reativas tenham os atributos
hostouportdefinidos
O Dev Services para AMQP conta com o Docker para iniciar o agente. Se o seu ambiente não for compatível com o Docker, você precisará iniciar o agente manualmente ou conectar-se a um agente já em execução. Você pode configurar o acesso ao agente usando as propriedades amqp-host , amqp-port , amqp-user e amqp-password .
Broker compartilhado
Most of the time, you need to share the broker between applications. Dev Services for AMQP implements a service discovery mechanism for your multiple Quarkus applications running in dev mode to share a single broker.
Dev Services para AMQP inicia o container com a etiqueta quarkus-dev-service-amqp que é utilizada para identificar o container.
|
Se precisar de vários brokers (compartilhados), você pode configurar o atributo quarkus.amqp.devservices.service-name e indicar o nome do broker. Ele procura um contêiner com o mesmo valor ou inicia um novo se nenhum for encontrado. O nome do serviço padrão é amqp .
O compartilhamento é ativado por padrão no modo de desenvolvimento, mas desativado no modo de teste. Você pode desativar o compartilhamento com quarkus.amqp.devservices.shared=false .
Definir a porta
Por padrão, o Dev Services for AMQP escolhe uma porta aleatória e configura a aplicação. Você pode definir a porta configurando a propriedade quarkus.amqp.devservices.port .
Configurando a imagem
Os serviços de desenvolvimento para AMQP usam imagens activemq-artemis-broker . Você pode configurar a imagem e a versão usando a propriedade quarkus.amqp.devservices.image-name :
quarkus.amqp.devservices.image-name=quay.io/artemiscloud/activemq-artemis-broker:1.0.25
A imagem configurada deve ser compatível com a imagem activemq-artemis-broker . O contêiner é iniciado com as variáveis de ambiente AMQ_USER , AMQ_PASSWORD e AMQ_EXTRA_ARGS . As portas 5672 e 8161 (console da Web) são expostas.
|
Compose
Dev Services for AMQP supports Compose Dev Services.
It relies on a compose-devservices.yml, such as:
name: <application name>
services:
artemis:
image: quay.io/artemiscloud/activemq-artemis-broker:1.0.25
ports:
- "5672"
- "8161"
environment:
AMQ_USER: quarkus
AMQ_PASSWORD: quarkus
AMQ_EXTRA_ARGS: --no-autotune --mapped --no-fsync --relax-jolokia
Configuration reference
Configuration property fixed at build time - All other configuration properties are overridable at runtime
Configuration property |
Tipo |
Padrão |
|---|---|---|
If Dev Services for AMQP has been explicitly enabled or disabled. Dev Services are generally enabled by default, unless there is an existing configuration present. For AMQP, 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 ActiveMQ Artemis images are supported. Specifically, the image repository must end with Check the activemq-artemis-broker on Quay page to find the available versions. Environment variable: Show more |
string |
|
The value of the Environment variable: Show more |
string |
|
Indicates if the AMQP 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 AMQP 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 AMQP brokers. Environment variable: Show more |
string |
|
Environment variables that are passed to the container. Environment variable: Show more |
Map<String,String> |