final case class ConsumerSettings(properties: Map[String, AnyRef] = Map.empty, closeTimeout: zio.Duration = 30.seconds, pollTimeout: zio.Duration = 50.millis, commitTimeout: zio.Duration = ..., offsetRetrieval: OffsetRetrieval = OffsetRetrieval.Auto(), rebalanceListener: RebalanceListener = RebalanceListener.noop, restartStreamOnRebalancing: Boolean = false, fetchStrategy: FetchStrategy = QueueSizeBasedFetchStrategy()) extends Product with Serializable
Settings for the consumer.
To stay source compatible with future releases, you are recommended to construct the settings as follows:
ConsumerSettings(bootstrapServers) .withGroupId(groupId) .withProperties(properties) .... etc.
- Alphabetic
- By Inheritance
- ConsumerSettings
- Serializable
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new ConsumerSettings(properties: Map[String, AnyRef] = Map.empty, closeTimeout: zio.Duration = 30.seconds, pollTimeout: zio.Duration = 50.millis, commitTimeout: zio.Duration = ..., offsetRetrieval: OffsetRetrieval = OffsetRetrieval.Auto(), rebalanceListener: RebalanceListener = RebalanceListener.noop, restartStreamOnRebalancing: Boolean = false, fetchStrategy: FetchStrategy = QueueSizeBasedFetchStrategy())
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[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @IntrinsicCandidate()
- val closeTimeout: zio.Duration
- val commitTimeout: zio.Duration
- def driverSettings: Map[String, AnyRef]
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- val fetchStrategy: FetchStrategy
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
-
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() @IntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- val offsetRetrieval: OffsetRetrieval
- val pollTimeout: zio.Duration
- val properties: Map[String, AnyRef]
- val rebalanceListener: RebalanceListener
- val restartStreamOnRebalancing: Boolean
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
tuneForHighThroughput: ConsumerSettings
Tunes the consumer for high throughput.
Tunes the consumer for high throughput.
Sets poll timeout to 500 ms,
max.poll.recordsto 2000 andpartitionPreFetchBufferLimitto 4096. -
def
tuneForLowLatency: ConsumerSettings
Tunes the consumer for low latency.
Tunes the consumer for low latency.
Sets poll timeout to 50 ms,
max.poll.recordsto 100 andpartitionPreFetchBufferLimitto 512. -
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
- def withBootstrapServers(servers: List[String]): ConsumerSettings
- def withClientId(clientId: String): ConsumerSettings
- def withCloseTimeout(timeout: zio.Duration): ConsumerSettings
- def withCommitTimeout(timeout: zio.Duration): ConsumerSettings
- def withCredentials(credentialsStore: KafkaCredentialStore): ConsumerSettings
-
def
withFetchStrategy(fetchStrategy: FetchStrategy): ConsumerSettings
WARNING: zio.kafka.consumer.fetch.FetchStrategy is an EXPERIMENTAL API and may change in an incompatible way without notice in any zio-kafka version.
WARNING: zio.kafka.consumer.fetch.FetchStrategy is an EXPERIMENTAL API and may change in an incompatible way without notice in any zio-kafka version.
- fetchStrategy
The fetch strategy which selects which partitions can fetch data in the next poll. The default is to use the zio.kafka.consumer.fetch.QueueSizeBasedFetchStrategy with a
partitionPreFetchBufferLimitparameter of 1024, which is calculated by taking 2 * the defaultmax.poll.recordsof 500, rounded to the nearest power of 2.
- def withGroupId(groupId: String): ConsumerSettings
- def withGroupInstanceId(groupInstanceId: String): ConsumerSettings
-
def
withMaxPollInterval(maxPollInterval: zio.Duration): ConsumerSettings
Set Kafka's
max.poll.interval.msconfiguration.Set Kafka's
max.poll.interval.msconfiguration. See https://kafka.apache.org/documentation/#consumerconfigs_max.poll.interval.ms for more information.Zio-kafka uses this value also to determine whether a stream stopped processing. If no chunks are pulled from a stream for this interval (while data is available) we consider the stream to be halted. When this happens we interrupt the stream with a failure. In addition the entire consumer is shutdown. In future versions of zio-kafka we may (instead of a shutdown) stop only the affected subscription.
The default is 5 minutes. Make sure that all records from a single poll can be processed in this interval. The maximum number of records in a single poll is configured with the
max.poll.recordsconfiguration (see https://kafka.apache.org/documentation/#consumerconfigs_max.poll.records and withMaxPollRecords). -
def
withMaxPollRecords(maxPollRecords: Int): ConsumerSettings
Set Kafka's
max.poll.recordsconfiguration.Set Kafka's
max.poll.recordsconfiguration. See https://kafka.apache.org/documentation/#consumerconfigs_max.poll.records for more information. - def withOffsetRetrieval(retrieval: OffsetRetrieval): ConsumerSettings
-
def
withPartitionPreFetchBufferLimit(partitionPreFetchBufferLimit: Int): ConsumerSettings
- partitionPreFetchBufferLimit
The queue size below which more records are fetched and buffered (per partition). This buffer improves throughput and supports varying downstream message processing time, while maintaining some backpressure. Large values effectively disable backpressure at the cost of high memory usage, low values will effectively disable prefetching in favour of low memory consumption. The number of records that is fetched on every poll is controlled by the
max.poll.recordssetting, the number of records fetched for every partition is somewhere between 0 andmax.poll.records. A value that is a power of 2 offers somewhat better queueing performance. The default value for this parameter is 1024. It is calculated by taking 2 * the defaultmax.poll.recordsof 500, rounded to the nearest power of 2.
-
def
withPollTimeout(timeout: zio.Duration): ConsumerSettings
The maximum time to block while polling the Kafka consumer.
The maximum time to block while polling the Kafka consumer. The Kafka consumer will return earlier when the maximum number of record to poll (see https://kafka.apache.org/documentation/#consumerconfigs_max.poll.records) is collected.
The default is
50mswhich is good for low latency applications. Set this higher, e.g.500msfor better throughput. - def withProperties(kvs: Map[String, AnyRef]): ConsumerSettings
- def withProperties(kvs: (String, AnyRef)*): ConsumerSettings
- def withProperty(key: String, value: AnyRef): ConsumerSettings
- def withRebalanceListener(listener: RebalanceListener): ConsumerSettings
-
def
withRestartStreamOnRebalancing(value: Boolean): ConsumerSettings
- value
When
true_all_ streams are restarted during a rebalance, including those streams that are not revoked. The default isfalse.
Deprecated Value Members
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] ) @Deprecated
- Deprecated
-
def
withMaxPartitionQueueSize(partitionPreFetchBufferLimit: Int): ConsumerSettings
- Annotations
- @deprecated
- Deprecated
(Since version 2.6.0) Use withPartitionPreFetchBufferLimit instead