sealed abstract class ProducerSettings[F[_], K, V] extends AnyRef
ProducerSettings contain settings necessary to create a KafkaProducer.
At the very least, this includes a key serializer and a value serializer.
Several convenience functions are provided so that you don't have to work with
String
values and ProducerConfig
for configuration. It's still possible to
specify ProducerConfig
values with functions like withProperty.
ProducerSettings instances are immutable and all modification functions
return a new ProducerSettings instance.
Use ProducerSettings#apply
to create a new instance.
- Alphabetic
- By Inheritance
- ProducerSettings
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
blocker: Option[Blocker]
The
Blocker
to use for blocking Kafka operations.The
Blocker
to use for blocking Kafka operations. If not explicitly provided, a defaultBlocker
will be created when creating aKafkaProducer
instance. -
abstract
def
closeTimeout: FiniteDuration
The time to wait for the Java
KafkaProducer
to shutdown.
The default value is 60 seconds. -
abstract
def
createProducer: F[KafkaByteProducer]
Creates a new
Producer
using the properties.Creates a new
Producer
using the properties. Note that this operation should be bracketed, using e.g.Resource
, to ensure theclose
function on the producer is called. -
abstract
def
keySerializer: F[Serializer[F, K]]
The
Serializer
to use for serializing record keys. -
abstract
def
parallelism: Int
The maximum number of ProducerRecords to produce in the same batch.
The default value is 100. -
abstract
def
properties: Map[String, String]
Properties which can be provided when creating a Java
KafkaProducer
instance.Properties which can be provided when creating a Java
KafkaProducer
instance. Numerous functions in ProducerSettings add properties here if the settings are used by the JavaKafkaProducer
. -
abstract
def
valueSerializer: F[Serializer[F, V]]
The
Serializer
to use for serializing record values. -
abstract
def
withAcks(acks: Acks): ProducerSettings[F, K, V]
Returns a new ProducerSettings instance with the specified acknowledgements.
Returns a new ProducerSettings instance with the specified acknowledgements. This is equivalent to setting the following property using the withProperty function, except you can specify it with Acks instead of a
String
.ProducerConfig.ACKS_CONFIG
-
abstract
def
withBatchSize(batchSize: Int): ProducerSettings[F, K, V]
Returns a new ProducerSettings instance with the specified batch size.
Returns a new ProducerSettings instance with the specified batch size. This is equivalent to setting the following property using the withProperty function, except you can specify it with an
Int
instead of aString
.ProducerConfig.BATCH_SIZE_CONFIG
-
abstract
def
withBlocker(blocker: Blocker): ProducerSettings[F, K, V]
Returns a new ProducerSettings instance with the specified blocker to use for blocking operations.
-
abstract
def
withBootstrapServers(bootstrapServers: String): ProducerSettings[F, K, V]
Returns a new ProducerSettings instance with the specified bootstrap servers.
Returns a new ProducerSettings instance with the specified bootstrap servers. This is equivalent to setting the following property using the withProperty function.
ProducerConfig.BOOTSTRAP_SERVERS_CONFIG
-
abstract
def
withClientId(clientId: String): ProducerSettings[F, K, V]
Returns a new ProducerSettings instance with the specified client id.
Returns a new ProducerSettings instance with the specified client id. This is equivalent to setting the following property using the withProperty function.
ProducerConfig.CLIENT_ID_CONFIG
-
abstract
def
withCloseTimeout(closeTimeout: FiniteDuration): ProducerSettings[F, K, V]
Creates a new ProducerSettings with the specified closeTimeout.
-
abstract
def
withCreateProducer(createProducer: (Map[String, String]) ⇒ F[KafkaByteProducer]): ProducerSettings[F, K, V]
Creates a new ProducerSettings with the specified function for creating
Producer
instances in createProducer.Creates a new ProducerSettings with the specified function for creating
Producer
instances in createProducer. The argument is the properties of the settings instance. -
abstract
def
withDeliveryTimeout(deliveryTimeout: FiniteDuration): ProducerSettings[F, K, V]
Returns a new ProducerSettings instance with the specified delivery timeout.
Returns a new ProducerSettings instance with the specified delivery timeout. This is equivalent to setting the following property using the withProperty function, except you can specify it with a
FiniteDuration
instead of aString
.ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIG
-
abstract
def
withEnableIdempotence(enableIdempotence: Boolean): ProducerSettings[F, K, V]
Returns a new ProducerSettings instance with the specified idempotence setting.
Returns a new ProducerSettings instance with the specified idempotence setting. This is equivalent to setting the following property using the withProperty function, except you can specify it with a
Boolean
instead of aString
.ProducerConfig.ENABLE_IDEMPOTENCE_CONFIG
-
abstract
def
withLinger(linger: FiniteDuration): ProducerSettings[F, K, V]
Returns a new ProducerSettings instance with the specified linger.
Returns a new ProducerSettings instance with the specified linger. This is equivalent to setting the following property using the withProperty function, except you can specify it with a
FiniteDuration
instead of aString
.ProducerConfig.LINGER_MS_CONFIG
-
abstract
def
withMaxInFlightRequestsPerConnection(maxInFlightRequestsPerConnection: Int): ProducerSettings[F, K, V]
Returns a new ProducerSettings instance with the specified max in-flight requests per connection.
Returns a new ProducerSettings instance with the specified max in-flight requests per connection. This is equivalent to setting the following property using the withProperty function, except you can specify it with an
Int
instead of aString
.ProducerConfig.MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION
-
abstract
def
withParallelism(parallelism: Int): ProducerSettings[F, K, V]
Creates a new ProducerSettings with the specified parallelism.
-
abstract
def
withProperties(properties: Map[String, String]): ProducerSettings[F, K, V]
Includes the specified keys and values as properties.
Includes the specified keys and values as properties. The keys should be part of the
ProducerConfig
keys, and the values should be valid choices for the keys. -
abstract
def
withProperties(properties: (String, String)*): ProducerSettings[F, K, V]
Includes the specified keys and values as properties.
Includes the specified keys and values as properties. The keys should be part of the
ProducerConfig
keys, and the values should be valid choices for the keys. -
abstract
def
withProperty(key: String, value: String): ProducerSettings[F, K, V]
Includes a property with the specified
key
andvalue
.Includes a property with the specified
key
andvalue
. The key should be one of the keys inProducerConfig
, and the value should be a valid choice for the key. -
abstract
def
withRequestTimeout(requestTimeout: FiniteDuration): ProducerSettings[F, K, V]
Returns a new ProducerSettings instance with the specified request timeout.
Returns a new ProducerSettings instance with the specified request timeout. This is equivalent to setting the following property using the withProperty function, except you can specify it with a
FiniteDuration
instead of aString
.ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG
-
abstract
def
withRetries(retries: Int): ProducerSettings[F, K, V]
Returns a new ProducerSettings instance with the specified retries.
Returns a new ProducerSettings instance with the specified retries. This is equivalent to setting the following property using the withProperty function, except you can specify it with an
Int
instead of aString
.ProducerConfig.RETRIES_CONFIG
-
abstract
def
withTransactionTimeout(transactionTimeout: FiniteDuration): ProducerSettings[F, K, V]
Returns a new ProducerSettings instance with the specified transaction timeout.
Returns a new ProducerSettings instance with the specified transaction timeout. This is equivalent to setting the following property using the withProperty function, except you can specify it with a
FiniteDuration
instead of aString
.ProducerConfig.TRANSACTION_TIMEOUT_CONFIG
-
abstract
def
withTransactionalId(transactionalId: String): ProducerSettings[F, K, V]
Returns a new ProducerSettings instance with the specified transactional ID.
Returns a new ProducerSettings instance with the specified transactional ID. This is equivalent to setting the following property using the withProperty function.
ProducerConfig.TRANSACTIONAL_ID_CONFIG
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )