The English version of quarkus.io is the official project site. Translated sites are community supported on a best-effort basis.

Dev Services para 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 como false

  • o pulsar.client.serviceUrl está configurado

  • todos os canais Pulsar de mensagens reativas têm o atributo serviceUrl definido

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.

O Dev Services para Pulsar inicia o contêiner com a etiqueta quarkus-dev-service-pulsar que é utilizada para identificar o contêiner.

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 pulsar.client.serviceUrl is set or if all the Reactive Messaging Pulsar channel are configured with serviceUrl.

Environment variable: QUARKUS_PULSAR_DEVSERVICES_ENABLED

Show more

boolean

Optional fixed port the dev service will listen to.

If not defined, the port will be chosen randomly.

Environment variable: QUARKUS_PULSAR_DEVSERVICES_PORT

Show more

int

The image to use. Note that only Apache Pulsar images are supported. Specifically, the image repository must end with apachepulsar/pulsar. Check https://hub.docker.com/r/apachepulsar/pulsar to find the available versions.

Environment variable: QUARKUS_PULSAR_DEVSERVICES_IMAGE_NAME

Show more

string

apachepulsar/pulsar:3.2.4

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 quarkus-dev-service-pulsar label. The value is configured using the service-name property.

Container sharing is only used in dev mode.

Environment variable: QUARKUS_PULSAR_DEVSERVICES_SHARED

Show more

boolean

true

The value of the quarkus-dev-service-pulsar label attached to the started container. This property is used when shared is set to true. In this case, before starting a container, Dev Services for Pulsar looks for a container with the quarkus-dev-service-pulsar label set to the configured value. If found, it will use this container instead of starting a new one. Otherwise, it starts a new container with the quarkus-dev-service-pulsar label set to the specified value.

This property is used when you need multiple shared Pulsar brokers.

Environment variable: QUARKUS_PULSAR_DEVSERVICES_SERVICE_NAME

Show more

string

pulsar

Broker config to set on the Pulsar instance

Environment variable: QUARKUS_PULSAR_DEVSERVICES_BROKER_CONFIG__ENVIRONMENT_VARIABLE_NAME_

Show more

Map<String,String>

Conteúdo Relacionado