MockKafkaConsumer

io.github.jchapuis.fs2.kafka.mock.MockKafkaConsumer
See theMockKafkaConsumer companion object

Defines methods for a mock kafka consumer: allows for publishing test messages and provides a MkConsumer instance

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Abstract methods

def publish[K, V](topic: String, key: K, value: V, timestamp: Option[Instant])(implicit keySerializer: KeySerializer[IO, K], valueSerializer: ValueSerializer[IO, V]): IO[Unit]

Publish a message to the topic.

Publish a message to the topic.

Semantically blocking until a consumer subscribes to the topic: internally, it's polling for assignments, as the native kafka mock doesn't support upfront publication but requires an assignment to be made before publishing.

Attributes

K

the key type

V

the value type

key

the key to publish

keySerializer

the key serializer

timestamp

optional timestamp of the message

topic

the topic to publish to

value

the value to publish

valueSerializer

the value serializer

Returns:

once published, a unit

def redact[K](topic: String, key: K)(implicit keySerializer: KeySerializer[IO, K]): IO[Unit]

Redact a message from the topic, aka. publish a tombstone.

Redact a message from the topic, aka. publish a tombstone.

Attributes

K

the key type

key

the key to redact

keySerializer

the key serializer

topic

the topic to redact from

Returns:

once redacted, a unit

Implicits

Implicits

implicit def mkConsumer: MkConsumer[IO]

MkConsumer instance providing the mock consumer. Including this instance in implicit scope where the kafka consumer resource is created will feed it with the mock consumer instance instead of the default, real one.

MkConsumer instance providing the mock consumer. Including this instance in implicit scope where the kafka consumer resource is created will feed it with the mock consumer instance instead of the default, real one.

Attributes