Configure the Kinesis Producer Library
Although the default settings should work well for most use cases, you may want to change
some of the default settings to tailor the behavior of the KinesisProducer
to
your needs. An instance of the KinesisProducerConfiguration
class can be passed
to the KinesisProducer
constructor to do so, for example:
KinesisProducerConfiguration config = new KinesisProducerConfiguration() .setRecordMaxBufferedTime(3000) .setMaxConnections(1) .setRequestTimeout(60000) .setRegion("us-west-1"); final KinesisProducer kinesisProducer = new KinesisProducer(config);
You can also load a configuration from a properties file:
KinesisProducerConfiguration config = KinesisProducerConfiguration.fromPropertiesFile("default_config.properties");
You can substitute any path and file name that the user process has access to. You can
additionally call set methods on the KinesisProducerConfiguration
instance
created this way to customize the config.
The properties file should specify parameters using their names in PascalCase. The names
match those used in the set methods in the KinesisProducerConfiguration
class.
For example:
RecordMaxBufferedTime = 100
MaxConnections = 4
RequestTimeout = 6000
Region = us-west-1
For more information about configuration parameter usage rules and value limits, see the
sample configuration properties file on GitHub
Note that after KinesisProducer
is initialized, changing the
KinesisProducerConfiguration
instance that was used has no further effect.
KinesisProducer
does not currently support dynamic reconfiguration.