ちょうど前方にあなたのApacheカフカのJavadocへProducerConfig用ドキュメント、あなたはakka.kafka.producer.kafka-clients
configセクション内のキーとして使用できる定数の束を含んでいるので。
ドキュメントから参照設定を拡張、例は次のようになります。
# Properties for akka.kafka.ProducerSettings can be
# defined in this section or a configuration section with
# the same layout.
akka.kafka.producer {
# Tuning parameter of how many sends that can run in parallel.
parallelism = 100
# How long to wait for `KafkaProducer.close`
close-timeout = 60s
# Fully qualified config path which holds the dispatcher configuration
# to be used by the producer stages. Some blocking may occur.
# When this value is empty, the dispatcher configured for the stream
# will be used.
use-dispatcher = "akka.kafka.default-dispatcher"
# Properties defined by org.apache.kafka.clients.producer.ProducerConfig
# can be defined in this configuration section.
kafka-clients {
bootstrap.servers = "localhost:9092"
enable.auto.commit = true
auto.commit.interval.ms = 10000
acks = "all"
retries = 0
batch.size = 16384
}
}
あなたapplication.conf
ファイルの内容がそのようにあなたは以下のとおりProducerSettings
オブジェクトを作成するたびに、あなたのActorSystem
により、デフォルトでロードされます、それはakka.kafka.producer
からの設定を取る必要があります。設定をコンストラクタに明示的に渡す必要はありません。
あなたのコメントをいただきありがとうございました。この設定ファイルを使用して、ProducerSettingsプロパティを初期化/設定する方法を知りたいと思いました。 – Explorer
私は答えを更新しました。基本的に、その設定はAkkaによって自動的にロードされるべきで、明示的に何もする必要はありません。 –
それは働きました、私はクラスディレクトリにリソースディレクトリを持っていませんでした。ありがとう – Explorer