class ConsumerSettings[K, V] extends AnyRef

Settings for consumers. See akka.kafka.consumer section in reference.conf. Note that the companion object provides apply and create functions for convenient construction of the settings, together with the with methods.

The constructor is Internal API.

Source
ConsumerSettings.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ConsumerSettings
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. val closeTimeout: FiniteDuration
  2. val commitRefreshInterval: Duration
  3. val commitTimeWarning: FiniteDuration
  4. val commitTimeout: FiniteDuration
  5. val connectionCheckerSettings: ConnectionCheckerSettings
  6. val consumerFactory: (ConsumerSettings[K, V]) => Consumer[K, V]
  7. val consumerGroupUpdateInterval: FiniteDuration
  8. def createKafkaConsumer(): Consumer[K, V]

    Create a Kafka Consumer instance from these settings.

    Create a Kafka Consumer instance from these settings.

    This will fail with IllegalStateException if asynchronous enrichment is set up -- always prefer createKafkaConsumerAsync() or createKafkaConsumerCompletionStage().

    Exceptions thrown

    IllegalStateException if asynchronous enrichment is set via withEnrichAsync or withEnrichCompletionStage, you must use createKafkaConsumerAsync or createKafkaConsumerCompletionStage to apply it

  9. def createKafkaConsumerAsync()(implicit executionContext: ExecutionContext): Future[Consumer[K, V]]

    Scala API.

    Scala API.

    Create a Kafka Consumer instance from these settings (without blocking for enriched).

  10. def createKafkaConsumerCompletionStage(executor: Executor): CompletionStage[Consumer[K, V]]

    Java API.

    Java API.

    Create a Kafka Consumer instance from these settings (without blocking for enriched).

  11. val dispatcher: String
  12. val drainingCheckInterval: FiniteDuration
  13. val enrichAsync: Option[(ConsumerSettings[K, V]) => Future[ConsumerSettings[K, V]]]
  14. def enriched: Future[ConsumerSettings[K, V]]

    Applies enrichAsync to complement these settings from asynchronous sources.

  15. def getCloseTimeout: Duration
  16. def getMetadataRequestTimeout: Duration
  17. def getOffsetForTimesTimeout: Duration
  18. def getPositionTimeout: Duration
  19. def getProperties: Map[String, AnyRef]

    Get the Kafka consumer settings as map.

  20. def getProperty(key: String): String

    Java API: Get a raw property.

    Java API: Get a raw property. null if it is not defined.

  21. val keyDeserializerOpt: Option[Deserializer[K]]
  22. val metadataRequestTimeout: FiniteDuration
  23. val offsetForTimesTimeout: FiniteDuration
  24. val partitionHandlerWarning: FiniteDuration
  25. val pollInterval: FiniteDuration
  26. val pollTimeout: FiniteDuration
  27. val positionTimeout: FiniteDuration
  28. val properties: Map[String, String]
  29. val resetProtectionSettings: OffsetResetProtectionSettings
  30. val stopTimeout: FiniteDuration
  31. def toString(): String
    Definition Classes
    ConsumerSettings → AnyRef → Any
  32. val valueDeserializerOpt: Option[Deserializer[V]]
  33. val waitClosePartition: FiniteDuration
  34. def withBootstrapServers(bootstrapServers: String): ConsumerSettings[K, V]

    A comma-separated list of host/port pairs to use for establishing the initial connection to the Kafka cluster.

  35. def withClientId(clientId: String): ConsumerSettings[K, V]

    An id string to pass to the server when making requests.

    An id string to pass to the server when making requests. The purpose of this is to be able to track the source of requests beyond just ip/port by allowing a logical application name to be included in server-side request logging.

  36. def withCloseTimeout(closeTimeout: Duration): ConsumerSettings[K, V]

    Java API: Set duration to wait for KafkaConsumer.close to finish.

  37. def withCloseTimeout(closeTimeout: FiniteDuration): ConsumerSettings[K, V]

    Set duration to wait for KafkaConsumer.close to finish.

  38. def withCommitRefreshInterval(commitRefreshInterval: Duration): ConsumerSettings[K, V]

    Java API: If set to a finite duration, the consumer will re-send the last committed offsets periodically for all assigned partitions.

    Java API: If set to a finite duration, the consumer will re-send the last committed offsets periodically for all assigned partitions. @see https://issues.apache.org/jira/browse/KAFKA-4682 Set to java.time.Duration.ZERO to switch it off.

    See also

    https://issues.apache.org/jira/browse/KAFKA-4682

  39. def withCommitRefreshInterval(commitRefreshInterval: Duration): ConsumerSettings[K, V]

    If set to a finite duration, the consumer will re-send the last committed offsets periodically for all assigned partitions.

    If set to a finite duration, the consumer will re-send the last committed offsets periodically for all assigned partitions.

    See also

    https://issues.apache.org/jira/browse/KAFKA-4682

  40. def withCommitTimeout(commitTimeout: Duration): ConsumerSettings[K, V]

    Java API: If offset commit requests are not completed within this timeout the returned Future is completed with akka.kafka.CommitTimeoutException.

  41. def withCommitTimeout(commitTimeout: FiniteDuration): ConsumerSettings[K, V]

    If offset commit requests are not completed within this timeout the returned Future is completed with akka.kafka.CommitTimeoutException.

  42. def withCommitWarning(commitTimeWarning: Duration): ConsumerSettings[K, V]

    Java API: If commits take longer than this time a warning is logged

  43. def withCommitWarning(commitTimeWarning: FiniteDuration): ConsumerSettings[K, V]

    If commits take longer than this time a warning is logged

  44. def withConnectionChecker(kafkaConnectionCheckerConfig: ConnectionCheckerSettings): ConsumerSettings[K, V]

    Enable kafka connection checker with provided settings

  45. def withConsumerFactory(factory: (ConsumerSettings[K, V]) => Consumer[K, V]): ConsumerSettings[K, V]

    Replaces the default Kafka consumer creation logic.

  46. def withConsumerGroupUpdateInterval(interval: Duration): ConsumerSettings[K, V]

    Java API: For transactional flows only, how often to push consumer group metadata to the producers a shorter interval makes the risk of dropping batched elements smaller but at the cost of more work sending those updates.

  47. def withConsumerGroupUpdateInterval(interval: FiniteDuration): ConsumerSettings[K, V]

    Scala API: For transactional flows only, how often to push consumer group metadata to the producers a shorter interval makes the risk of dropping batched elements smaller but at the cost of more work sending those updates.

  48. def withDispatcher(dispatcher: String): ConsumerSettings[K, V]

    Fully qualified config path which holds the dispatcher configuration to be used by the akka.kafka.KafkaConsumerActor.

    Fully qualified config path which holds the dispatcher configuration to be used by the akka.kafka.KafkaConsumerActor. Some blocking may occur.

  49. def withDrainingCheckInterval(drainingCheckInterval: Duration): ConsumerSettings[K, V]

    Java API: Check interval for TransactionalProducer when finishing transaction before shutting down consumer

  50. def withDrainingCheckInterval(drainingCheckInterval: FiniteDuration): ConsumerSettings[K, V]

    Scala API: Check interval for TransactionalProducer when finishing transaction before shutting down consumer

  51. def withEnrichAsync(value: (ConsumerSettings[K, V]) => Future[ConsumerSettings[K, V]]): ConsumerSettings[K, V]

    Scala API.

    Scala API. A hook to allow for resolving some settings asynchronously.

    Since

    2.0.0

  52. def withEnrichCompletionStage(value: Function[ConsumerSettings[K, V], CompletionStage[ConsumerSettings[K, V]]]): ConsumerSettings[K, V]

    Java API.

    Java API. A hook to allow for resolving some settings asynchronously.

    Since

    2.0.0

  53. def withGroupId(groupId: String): ConsumerSettings[K, V]

    A unique string that identifies the consumer group this consumer belongs to.

  54. def withGroupInstanceId(groupInstanceId: String): ConsumerSettings[K, V]

    An id string that marks consumer as a unique static member of the consumer group.

  55. def withMetadataRequestTimeout(metadataRequestTimeout: Duration): ConsumerSettings[K, V]

    Java API

  56. def withMetadataRequestTimeout(metadataRequestTimeout: FiniteDuration): ConsumerSettings[K, V]

    Scala API

  57. def withOffsetForTimesTimeout(offsetForTimesTimeout: Duration): ConsumerSettings[K, V]

    Java API: Limits the blocking on Kafka consumer offsetForTimes calls.

  58. def withOffsetForTimesTimeout(offsetForTimesTimeout: FiniteDuration): ConsumerSettings[K, V]

    Scala API: Limits the blocking on Kafka consumer offsetForTimes calls.

  59. def withPartitionAssignmentStrategies(strategies: Array[String]): ConsumerSettings[K, V]

    A list of class names or class types, ordered by preference, of supported partition assignment strategies that the client will use to distribute partition ownership amongst consumer instances when group management is used.

    A list of class names or class types, ordered by preference, of supported partition assignment strategies that the client will use to distribute partition ownership amongst consumer instances when group management is used.

    See https://kafka.apache.org/documentation/#consumerconfigs_partition.assignment.strategy

  60. def withPartitionAssignmentStrategyCooperativeStickyAssignor(): ConsumerSettings[K, V]

    Sets the CooperativeStickyAssignor assignment strategy.

    Sets the CooperativeStickyAssignor assignment strategy.

    See also

    https://kafka.apache.org/documentation/#consumerconfigs_partition.assignment.strategy

    https://kafka.apache.org/33/documentation.html#upgrade_300_notable

  61. def withPartitionHandlerWarning(partitionHandlerWarning: Duration): ConsumerSettings[K, V]

    Java API

  62. def withPartitionHandlerWarning(partitionHandlerWarning: FiniteDuration): ConsumerSettings[K, V]

    Scala API

  63. def withPollInterval(pollInterval: Duration): ConsumerSettings[K, V]

    Java API: Set the interval from one scheduled poll to the next.

  64. def withPollInterval(pollInterval: FiniteDuration): ConsumerSettings[K, V]

    Set the interval from one scheduled poll to the next.

  65. def withPollTimeout(pollTimeout: Duration): ConsumerSettings[K, V]

    Java API: Set the maximum duration a poll to the Kafka broker is allowed to take.

  66. def withPollTimeout(pollTimeout: FiniteDuration): ConsumerSettings[K, V]

    Set the maximum duration a poll to the Kafka broker is allowed to take.

  67. def withPositionTimeout(positionTimeout: Duration): ConsumerSettings[K, V]

    Java API: Limits the blocking on Kafka consumer position calls.

  68. def withPositionTimeout(positionTimeout: FiniteDuration): ConsumerSettings[K, V]

    Scala API: Limits the blocking on Kafka consumer position calls.

  69. def withProperties(properties: Map[String, String]): ConsumerSettings[K, V]

    Java API: The raw properties of the kafka-clients driver, see constants in org.apache.kafka.clients.consumer.ConsumerConfig.

  70. def withProperties(properties: (String, String)*): ConsumerSettings[K, V]

    Scala API: The raw properties of the kafka-clients driver, see constants in org.apache.kafka.clients.consumer.ConsumerConfig.

  71. def withProperties(properties: Map[String, String]): ConsumerSettings[K, V]

    Scala API: The raw properties of the kafka-clients driver, see constants in org.apache.kafka.clients.consumer.ConsumerConfig.

  72. def withProperty(key: String, value: String): ConsumerSettings[K, V]

    The raw properties of the kafka-clients driver, see constants in org.apache.kafka.clients.consumer.ConsumerConfig.

  73. def withResetProtectionSettings(resetProtection: OffsetResetProtectionSettings): ConsumerSettings[K, V]

    Set the protection for unintentional offset reset.

  74. def withStopTimeout(stopTimeout: Duration): ConsumerSettings[K, V]

    Java API: The stage will await outstanding offset commit requests before shutting down, but if that takes longer than this timeout it will stop forcefully.

  75. def withStopTimeout(stopTimeout: FiniteDuration): ConsumerSettings[K, V]

    The stage will await outstanding offset commit requests before shutting down, but if that takes longer than this timeout it will stop forcefully.

  76. def withWaitClosePartition(waitClosePartition: Duration): ConsumerSettings[K, V]

    Java API: Time to wait for pending requests when a partition is closed.

  77. def withWaitClosePartition(waitClosePartition: FiniteDuration): ConsumerSettings[K, V]

    Time to wait for pending requests when a partition is closed.