MockKafkaProducer

io.github.jchapuis.fs2.kafka.mock.MockKafkaProducer
See theMockKafkaProducer companion object

Defines methods for a mock kafka producer: allows for checking for test messages and provides a MkProducer instance. Keeps an internal offset for each topic so that messages can be consumed one by one with convenience methods.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def historyFor[K, V](topic: String)(implicit keyDeserializer: KeyDeserializer[IO, K], valueDeserializer: ValueDeserializer[IO, V]): IO[List[(K, V)]]

Returns the list of published messages for the given topic.

Returns the list of published messages for the given topic.

Type parameters

K

the key type

V

the value type

Value parameters

keyDeserializer

the key deserializer

topic

the topic to get the history for

valueDeserializer

the value deserializer

Attributes

Returns

the list of published messages thus far

def historyFor[K : Eq, V](topic: String, key: K)(implicit evidence$1: Eq[K], keyDeserializer: KeyDeserializer[IO, K], valueDeserializer: ValueDeserializer[IO, V]): IO[List[V]]

Returns the list of published messages for the given topic and key.

Returns the list of published messages for the given topic and key.

Type parameters

K

the key type

V

the value type

Value parameters

key

the key to get the history for

keyDeserializer

the key deserializer

topic

the topic to get the history for

valueDeserializer

the value deserializer

Attributes

Returns

the list of published messages thus far

def nextEventualMessageFor[K, V](topic: String)(implicit patience: Patience, keyDeserializer: KeyDeserializer[IO, K], valueDeserializer: ValueDeserializer[IO, V]): IO[(K, V)]

Returns the next message for the given topic. Semantically blocks, with polling intervals and timeout specified with the patience implicit parameter

Returns the next message for the given topic. Semantically blocks, with polling intervals and timeout specified with the patience implicit parameter

Value parameters

keyDeserializer

the key deserializer

patience

the patience to use for polling for the next message

topic

the topic to get the next message for

valueDeserializer

the value deserializer

Attributes

Throws
NoSuchElementException

if no message is available before the timeout

def nextEventualValueFor[K : Eq, V](topic: String, key: K)(implicit evidence$3: Eq[K], patience: Patience, keyDeserializer: KeyDeserializer[IO, K], valueDeserializer: ValueDeserializer[IO, V]): IO[V]

Returns the next message for the given topic and key. Semantically blocks, with polling intervals and timeout specified with the patience implicit parameter

Returns the next message for the given topic and key. Semantically blocks, with polling intervals and timeout specified with the patience implicit parameter

Value parameters

key

the key to get the next message for

keyDeserializer

the key deserializer

patience

the patience to use for polling for the next message

topic

the topic to get the next message for

valueDeserializer

the value deserializer

Attributes

Throws
NoSuchElementException

if no message is available before the timeout

def nextMessageFor[K, V](topic: String)(implicit keyDeserializer: KeyDeserializer[IO, K], valueDeserializer: ValueDeserializer[IO, V]): IO[Option[(K, V)]]

Returns the next message for the given topic, if any. Increments the internal offset for the topic.

Returns the next message for the given topic, if any. Increments the internal offset for the topic.

Type parameters

K

the key type

V

the value type

Value parameters

keyDeserializer

the key deserializer

topic

the topic to get the next message for

valueDeserializer

the value deserializer

Attributes

Returns

the next message for the given topic, if any

def nextValueFor[K : Eq, V](topic: String, key: K)(implicit evidence$2: Eq[K], keyDeserializer: KeyDeserializer[IO, K], valueDeserializer: ValueDeserializer[IO, V]): IO[Option[V]]

Returns the next message for the given topic and key, if any. Increments the internal offset for the topic.

Returns the next message for the given topic and key, if any. Increments the internal offset for the topic.

Type parameters

K

the key type

V

the value type

Value parameters

key

the key to get the next message for

keyDeserializer

the key deserializer

topic

the topic to get the next message for

valueDeserializer

the value deserializer

Attributes

Returns

the next message for the given topic and key, if any

Implicits

Implicits

implicit def mkProducer: MkProducer[IO]

MkProducer instance providing the mock producer. Including this instance in implicit scope where the kafka producer is created will feed it with the mock producer instance instead of the real one

MkProducer instance providing the mock producer. Including this instance in implicit scope where the kafka producer is created will feed it with the mock producer instance instead of the real one

Attributes