Object

zio.kafka.consumer

Consumer

Related Doc: package consumer

Permalink

object Consumer extends Serializable

Linear Supertypes
Serializable, Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Consumer
  2. Serializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. sealed trait AutoOffsetStrategy extends AnyRef

    Permalink
  2. final case class Live[R, K, V](consumer: ConsumerAccess, settings: ConsumerSettings, runloop: Runloop, keyDeserializer: Deserializer[R, K], valueDeserializer: Deserializer[R, V]) extends Service[R, K, V] with Product with Serializable

    Permalink
  3. sealed trait OffsetRetrieval extends AnyRef

    Permalink
  4. trait Service[R, K, V] extends AnyRef

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. object AutoOffsetStrategy

    Permalink
  5. object OffsetRetrieval

    Permalink
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def assignment[R, K, V](implicit tsv: Tagged[Service[R, K, V]]): RIO[R with Blocking with Consumer[R, K, V], Set[TopicPartition]]

    Permalink

    Accessor method for Service.assignment

  8. def beginningOffsets[R, K, V](partitions: Set[TopicPartition], timeout: Duration = Duration.Infinity)(implicit tsv: Tagged[Service[R, K, V]]): RIO[R with Blocking with Consumer[R, K, V], Map[TopicPartition, Long]]

    Permalink

    Accessor method for Service.beginningOffsets

  9. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. def committed[R, K, V](partitions: Set[TopicPartition], timeout: Duration = Duration.Infinity)(implicit tsv: Tagged[Service[R, K, V]]): RIO[R with Blocking with Consumer[R, K, V], Map[TopicPartition, Option[OffsetAndMetadata]]]

    Permalink

    Accessor method for Service.committed

  11. def consumeWith[R, R1, K, V](settings: ConsumerSettings, subscription: Subscription, keyDeserializer: Deserializer[R1, K], valueDeserializer: Deserializer[R1, V], commitRetryPolicy: Schedule[Clock, Any, Any] = ...)(f: (K, V) ⇒ ZIO[R, Nothing, Unit])(implicit tkd: Tagged[Deserializer[R1, K]], thkd: Tagged[Has[Deserializer[R1, K]]], tvd: Tagged[Deserializer[R1, V]], thvd: Tagged[Has[Deserializer[R1, V]]], ts: Tagged[Service[R1, K, V]]): ZIO[R with R1 with Blocking with Clock, Throwable, Unit]

    Permalink

    Execute an effect for each record and commit the offset after processing

    Execute an effect for each record and commit the offset after processing

    This method is the easiest way of processing messages on a Kafka topic.

    Messages on a single partition are processed sequentially, while the processing of multiple partitions happens in parallel.

    Offsets are committed after execution of the effect. They are batched when a commit action is in progress to avoid backpressuring the stream. When commits fail due to a org.apache.kafka.clients.consumer.RetriableCommitFailedException they are retried according to commitRetryPolicy

    The effect should absorb any failures. Failures should be handled by retries or ignoring the error, which will result in the Kafka message being skipped.

    Messages are processed with 'at least once' consistency: it is not guaranteed that every message that is processed by the effect has a corresponding offset commit before stream termination.

    Usage example:

    val settings: ConsumerSettings = ???
    val subscription = Subscription.Topics(Set("my-kafka-topic"))
    
    val consumerIO = Consumer.consumeWith(settings, subscription, Serdes.string, Serdes.string) { case (key, value) =>
      // Process the received record here
      putStrLn(s"Received record: ${key}: ${value}")
    }
    R

    Environment for the consuming effect

    R1

    Environment for the deserializers

    K

    Type of keys (an implicit Deserializer should be in scope)

    V

    Type of values (an implicit Deserializer should be in scope)

    settings

    Settings for creating a Consumer

    subscription

    Topic subscription parameters

    keyDeserializer

    Deserializer for the key of the messages

    valueDeserializer

    Deserializer for the value of the messages

    commitRetryPolicy

    Retry commits that failed due to a RetriableCommitFailedException according to this schedule

    f

    Function that returns the effect to execute for each message. It is passed the key and value

    returns

    Effect that completes with a unit value only when interrupted. May fail when the Consumer fails.

  12. def endOffsets[R, K, V](partitions: Set[TopicPartition], timeout: Duration = Duration.Infinity)(implicit tsv: Tagged[Service[R, K, V]]): RIO[R with Blocking with Consumer[R, K, V], Map[TopicPartition, Long]]

    Permalink

    Accessor method for Service.endOffsets

  13. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  15. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  16. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  17. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  18. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  19. def listTopics[R, K, V](timeout: Duration = Duration.Infinity)(implicit tsv: Tagged[Service[R, K, V]]): RIO[R with Blocking with Consumer[R, K, V], Map[String, List[PartitionInfo]]]

    Permalink

    Accessor method for Service.listTopics

  20. def live[R, K, V](implicit tkd: Tagged[Deserializer[R, K]], tvd: Tagged[Deserializer[R, V]], ts: Tagged[Service[R, K, V]]): ZLayer[Clock with Blocking with Has[Deserializer[R, K]] with Has[Deserializer[R, V]] with Has[ConsumerSettings] with Has[Diagnostics], Throwable, Consumer[R, K, V]]

    Permalink
  21. def make[R, K, V](settings: ConsumerSettings, keyDeserializer: Deserializer[R, K], valueDeserializer: Deserializer[R, V], diagnostics: Diagnostics = Diagnostics.NoOp)(implicit tkd: Tagged[Deserializer[R, K]], thkd: Tagged[Has[Deserializer[R, K]]], tvd: Tagged[Deserializer[R, V]], thvd: Tagged[Has[Deserializer[R, V]]], ts: Tagged[Service[R, K, V]]): ZLayer[Clock with Blocking, Throwable, Consumer[R, K, V]]

    Permalink
  22. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  23. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  24. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  25. val offsetBatches: ZSink[Any, Nothing, Nothing, Offset, OffsetBatch]

    Permalink
  26. def offsetsForTimes[R, K, V](timestamps: Map[TopicPartition, Long], timeout: Duration = Duration.Infinity)(implicit tsv: Tagged[Service[R, K, V]]): RIO[R with Blocking with Consumer[R, K, V], Map[TopicPartition, OffsetAndTimestamp]]

    Permalink

    Accessor method for Service.offsetsForTimes

  27. def partitionedStream[R, K, V](implicit tsv: Tagged[Service[R, K, V]]): ZStream[Consumer[R, K, V] with Clock with Blocking, Throwable, (TopicPartition, ZStreamChunk[R, Throwable, CommittableRecord[K, V]])]

    Permalink

    Accessor method for Service.partitionedStream

  28. def partitionsFor[R, K, V](topic: String, timeout: Duration = Duration.Infinity)(implicit tsv: Tagged[Service[R, K, V]]): RIO[R with Blocking with Consumer[R, K, V], List[PartitionInfo]]

    Permalink

    Accessor method for Service.partitionsFor

  29. def plainStream[R, K, V](implicit tsv: Tagged[Service[R, K, V]]): ZStreamChunk[R with Consumer[R, K, V] with Clock with Blocking, Throwable, CommittableRecord[K, V]]

    Permalink

    Accessor method for Service.plainStream

  30. def position[R, K, V](partition: TopicPartition, timeout: Duration = Duration.Infinity)(implicit tsv: Tagged[Service[R, K, V]]): RIO[R with Blocking with Consumer[R, K, V], Long]

    Permalink

    Accessor method for Service.position

  31. def stopConsumption[R, K, V](implicit tsv: Tagged[Service[R, K, V]]): RIO[Consumer[R, K, V], Unit]

    Permalink

    Accessor method for Service.stopConsumption

  32. def subscribe[R, K, V](subscription: Subscription)(implicit tsv: Tagged[Service[R, K, V]]): RIO[R with Blocking with Consumer[R, K, V], Unit]

    Permalink

    Accessor method for Service.subscribe

  33. def subscribeAnd[R, K, V](subscription: Subscription)(implicit tsv: Tagged[Service[R, K, V]]): SubscribedConsumerFromEnvironment[R, K, V]

    Permalink

    Accessor method for Service.subscribeAnd

  34. def subscription[R, K, V](implicit tsv: Tagged[Service[R, K, V]]): RIO[R with Blocking with Consumer[R, K, V], Set[String]]

    Permalink

    Accessor method for Service.subscription

  35. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  36. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  37. def unsubscribe[R, K, V](implicit tsv: Tagged[Service[R, K, V]]): RIO[R with Blocking with Consumer[R, K, V], Unit]

    Permalink

    Accessor method for Service.unsubscribe

  38. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  39. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  40. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  41. def withConsumerService[R, RC, K, V, A](r: (Service[R, K, V]) ⇒ RIO[R with RC with Blocking, A])(implicit tsv: Tagged[Service[R, K, V]]): RIO[R with RC with Blocking with Consumer[R, K, V], A]

    Permalink

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped