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.
Ativando / Desativando Dev Services para o Pulsar
Os Dev services para Pulsar são ativados automaticamente, a menos que:
-
quarkus.pulsar.devservices.enabledé definido comofalse -
o
pulsar.client.serviceUrlestá configurado -
todos os canais Pulsar de mensagens reativas têm o atributo
serviceUrldefinido
Dev Services para a Pulsar dependem do 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 endereço do agente usando pulsar.client..
Broker partilhado
Na maioria das vezes, você precisa compartilhar o broker entre os aplicativos. O Dev Services para Pulsar implementa um mecanismo de descoberta de serviços para que seus vários aplicativos Quarkus em execução no modo de desenvolvimento compartilhem um único broker.
Dev Services for Pulsar starts the container with the quarkus-dev-service-pulsar label which is used to identify the container.
|
Se precisar de vários brokers (compartilhados), você pode configurar o atributo quarkus.pulsar.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 é pulsar .
O compartilhamento é ativado por padrão no modo de desenvolvimento, mas desativado no modo de teste. Você pode desativar o compartilhamento com quarkus.pulsar.devservices.shared=false.
Definindo a porta
Por padrão, o Dev Services para Pulsar escolhe uma porta aleatória e configura o aplicativo. Você pode definir a porta configurando a propriedade quarkus.pulsar.devservices.port.
Note que o endereço anunciado pelo Pulsar é automaticamente configurado com a porta escolhida.
Configurando a imagem
O Dev Services para Pulsar suporta a imagem oficial do Apache Pulsar.
Um nome de imagem personalizado pode ser configurado. Por exemplo:
quarkus.pulsar.devservices.image-name=datastax/lunastreaming-all:2.10_4.7
Configurar o broker Pulsar
É possível configurar o Dev Services para a Pulsar com a configuração personalizada do broker.
O exemplo seguinte ativa o suporte de transação:
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 |
Tipo |
Padrão |
|---|---|---|
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 |
booleano |
|
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 |
booleano |
|
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> |