All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.http4k.connect.kafka.rest.v2.kafkarestExtensions.kt Maven / Gradle / Ivy

package org.http4k.connect.kafka.rest.v2

import dev.forkhandles.result4k.Result
import java.time.Duration
import kotlin.Array
import kotlin.Unit
import kotlin.collections.List
import org.http4k.connect.RemoteFailure
import org.http4k.connect.kafka.rest.KafkaRest
import org.http4k.connect.kafka.rest.model.ConsumerGroup
import org.http4k.connect.kafka.rest.model.ConsumerInstance
import org.http4k.connect.kafka.rest.model.Topic
import org.http4k.connect.kafka.rest.v2.action.CommitOffsets
import org.http4k.connect.kafka.rest.v2.action.ConsumeRecords
import org.http4k.connect.kafka.rest.v2.action.CreateConsumer
import org.http4k.connect.kafka.rest.v2.action.DeleteConsumer
import org.http4k.connect.kafka.rest.v2.action.GetOffsets
import org.http4k.connect.kafka.rest.v2.action.GetPartitions
import org.http4k.connect.kafka.rest.v2.action.NewConsumer
import org.http4k.connect.kafka.rest.v2.action.Partition
import org.http4k.connect.kafka.rest.v2.action.ProduceMessages
import org.http4k.connect.kafka.rest.v2.action.ProducedMessages
import org.http4k.connect.kafka.rest.v2.action.SeekOffsets
import org.http4k.connect.kafka.rest.v2.action.SubscribeToTopics
import org.http4k.connect.kafka.rest.v2.model.CommitOffset
import org.http4k.connect.kafka.rest.v2.model.CommitOffsetsSet
import org.http4k.connect.kafka.rest.v2.model.Consumer
import org.http4k.connect.kafka.rest.v2.model.PartitionOffsetRequest
import org.http4k.connect.kafka.rest.v2.model.RecordFormat
import org.http4k.connect.kafka.rest.v2.model.Records
import org.http4k.connect.kafka.rest.v2.model.SeekOffset
import org.http4k.connect.kafka.rest.v2.model.TopicRecord

/**
 * @see org.http4k.connect.kafka.rest.v2.action.CommitOffsets
 */
public fun KafkaRest.commitOffsets(
  group: ConsumerGroup,
  instance: ConsumerInstance,
  offsets: List,
): Result = invoke(CommitOffsets(group, instance, offsets))

/**
 * @see org.http4k.connect.kafka.rest.v2.action.ConsumeRecords
 */
public fun KafkaRest.consumeRecords(
  group: ConsumerGroup,
  instance: ConsumerInstance,
  format: RecordFormat,
  timeout: Duration? = null,
): Result?, RemoteFailure> = invoke(ConsumeRecords(group, instance, format,
    timeout))

/**
 * @see org.http4k.connect.kafka.rest.v2.action.CreateConsumer
 */
public fun KafkaRest.createConsumer(group: ConsumerGroup, consumer: Consumer):
    Result = invoke(CreateConsumer(group, consumer))

/**
 * @see org.http4k.connect.kafka.rest.v2.action.DeleteConsumer
 */
public fun KafkaRest.deleteConsumer(group: ConsumerGroup, instance: ConsumerInstance):
    Result = invoke(DeleteConsumer(group, instance))

/**
 * @see org.http4k.connect.kafka.rest.v2.action.GetOffsets
 */
public fun KafkaRest.getOffsets(
  group: ConsumerGroup,
  instance: ConsumerInstance,
  partitions: List,
): Result = invoke(GetOffsets(group, instance, partitions))

/**
 * @see org.http4k.connect.kafka.rest.v2.action.GetPartitions
 */
public fun KafkaRest.getPartitions(topic: Topic): Result?, RemoteFailure> =
    invoke(GetPartitions(topic))

/**
 * @see org.http4k.connect.kafka.rest.v2.action.ProduceMessages
 */
public fun KafkaRest.produceMessages(topic: Topic, records: Records):
    Result = invoke(ProduceMessages(topic, records))

/**
 * @see org.http4k.connect.kafka.rest.v2.action.SeekOffsets
 */
public fun KafkaRest.seekOffsets(
  group: ConsumerGroup,
  instance: ConsumerInstance,
  offsets: List,
): Result = invoke(SeekOffsets(group, instance, offsets))

/**
 * @see org.http4k.connect.kafka.rest.v2.action.SubscribeToTopics
 */
public fun KafkaRest.subscribeToTopics(
  group: ConsumerGroup,
  instance: ConsumerInstance,
  topics: List,
): Result = invoke(SubscribeToTopics(group, instance, topics))




© 2015 - 2024 Weber Informatics LLC | Privacy Policy