The English version of quarkus.io is the official project site. Translated sites are community supported on a best-effort basis.
このページを編集

Dev Services for Pulsar

Quarkus Messaging Pulsar エクステンション (quarkus-messaging-pulsar) を使用すると、Dev Services for Pulsar が開発モードおよびテスト実行時に自動で Pulsar ブローカーを起動します。 そのため、ブローカーを手動で起動する必要はありません。 また、アプリケーションの設定も自動的に行われます。

Dev Services for Pulsar の有効化/無効化

以下の場合を除き、Dev Services for Pulsar は自動的に有効になります。

  • quarkus.pulsar.devservices.enabledfalse に設定されている

  • `pulsar.client.serviceUrl`が設定されている

  • すべての Reactive Messaging Pulsar チャネルには `serviceUrl`属性が設定されている

Dev Services for Pulsar は、ブローカーを起動するために Docker に依存しています。環境が Docker をサポートしていない場合は、ブローカーを手動で起動するか、すでに実行中のブローカーに接続する必要があります。 pulsar.client. を使用してブローカーアドレスを設定できます。

共有ブローカー

ほとんどの場合、アプリケーション間でブローカーを共有する必要があります。Dev Services for Plusar は、 開発 モードで動作する複数の Quarkus アプリケーションが 1 つのブローカーを共有するための サービスディスカバリー メカニズムを実装しています。

Dev Services for Pulsar は、コンテナーを識別するために使用される quarkus-dev-service-pulsar ラベルを使用してコンテナーを起動します。

複数の (共有) ブローカーが必要な場合は、quarkus.pulsar.devservices.service-name 属性を設定してブローカー名を指定できます。 値が同じコンテナーを検索し、見つからない場合は新しいコンテナーを開始します。 デフォルトのサービス名は pulsar です。

開発モードでは共有はデフォルトで有効になっていますが、テストモードでは無効になっています。 quarkus.pulsar.devservices.shared=false で共有を無効にできます。

ポートの設定

デフォルトでは、Dev Services for Pulsar はランダムなポートを選択し、アプリケーションを設定します。 quarkus.pulsar.devservices.port プロパティーを設定することでポートを設定できます。

Pulsar がアドバタイズするアドレスは、選択したポートで自動的に設定されることに注意してください。

イメージの設定

Dev Services for Pulsar は、https://hub.docker.com/r/apachepulsar/pulsar[公式 Apache Pulsar イメージ] をサポートしています。

カスタムイメージ名は次のように設定できます。

quarkus.pulsar.devservices.image-name=datastax/lunastreaming-all:2.10_4.7

Pulsar ブローカーの設定

カスタムブローカー設定を使用して、Dev Services for Pulsar を設定できます。

次の例では、トランザクションサポートを有効にします。

quarkus.pulsar.devservices.broker-config.transaction-coordinator-enabled=true
quarkus.pulsar.devservices.broker-config.system-topic-enabled=true

設定リファレンス

ビルド時に固定される設定プロパティ - その他の設定プロパティは実行時にオーバーライド可能です。

Configuration property

タイプ

デフォルト

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

ブーリアン

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

ブーリアン

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>

関連コンテンツ