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.enabled
がfalse
に設定されている -
`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 Environment variable: Show more |
ブーリアン |
|
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 |
ブーリアン |
|
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> |