← ZIO Kafka docs

zio.kafka.producer

Members list

Packages

Type members

Classlikes

object Producer

Attributes

Companion
trait
Source
Producer.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Producer.type
trait Producer

Attributes

Companion
object
Source
Producer.scala
Supertypes
class Object
trait Matchable
class Any
sealed abstract class ProducerCompression(name: String, extra: Option[(String, AnyRef)] = ...)

Attributes

Companion
object
Source
ProducerCompression.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Gzip
class Lz4
object NoCompression
class Snappy
class Zstd

The compression codecs that Kafka supports while producing records.

The compression codecs that Kafka supports while producing records.

Attributes

Companion
class
Source
ProducerCompression.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed trait ProducerEvent

Attributes

Companion
object
Source
ProducerEvent.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object ProducerEvent

Diagnostics events for the Producer.

Diagnostics events for the Producer.

The producer always handles records in batches. Even single records results in batches of 1. The diagnostic events are therefore always about batches.

For each batch the RecordsOffered event is emitted first, followed by the RecordsSent event. Since batches are queued in the producer and sending one batch might go faster than the previous, the two event types can come in any order. However, the RecordsOffered events are always in the order the batches were offered.

To associate events to a batch you can use the batchId field. This is an ever-increasing number that is unique per producer and starts at 0. When a RecordsOffered and a RecordsSent event are for the same batch, the batchId and records fields have the same value.

Batches of 0 records do not result in events.

Attributes

Companion
trait
Source
ProducerEvent.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type

Attributes

Companion
class
Source
ProducerSettings.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class ProducerSettings(closeTimeout: Duration = ..., sendBufferSize: Int = ..., authErrorRetrySchedule: Schedule[Any, Throwable, Any] = ..., properties: Map[String, AnyRef] = ..., diagnostics: ProducerDiagnostics = ..., metricLabels: Set[MetricLabel] = ..., metricsObserver: Option[ProducerMetricsObserver] = ...)

Settings for the Producer.

Settings for the Producer.

To stay source compatible with future releases, you are recommended to construct the settings as follows:

 ProducerSettings(bootstrapServers)
   .withLinger(500.millis)
   .withCompression(ProducerCompression.Zstd(3))
   .... etc.

Attributes

Companion
object
Source
ProducerSettings.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
trait Transaction

Attributes

Source
Transaction.scala
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
trait
Source
TransactionalProducer.scala
Supertypes
class Object
trait Matchable
class Any
Self type

A producer that produces records transactionally.

A producer that produces records transactionally.

Attributes

Companion
object
Source
TransactionalProducer.scala
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
class
Source
TransactionalProducerSettings.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type

Settings for a transactional producer.

Settings for a transactional producer.

To stay source compatible with future releases, you are recommended to construct the settings as follows:

 val producerSettings = ProducerSettings(bootstrapServers)
   .withLinger(500.millis)
   .withCompression(ProducerCompression.Zstd(3))
   .... etc.
 TransactionalProducerSettings(producerSettings, transactionalId)

Attributes

Companion
object
Source
TransactionalProducerSettings.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Types

type ByteRecord = ProducerRecord[Array[Byte], Array[Byte]]

Attributes

Source
package.scala