Consumes the first message available in a given topic, deserializing it as type V).
Consumes the first message available in a given topic, deserializing it as type V).
Only the message that is returned is committed if autoCommit is false. If autoCommit is true then all messages that were polled will be committed.
the topic to consume a message from
if false, only the offset for the consumed message will be committed. if true, the offset for the last polled message will be committed instead. Defaulted to false.
an implicit EmbeddedKafkaConfig
an implicit org.apache.kafka.common.serialization.Deserializer for the type K
an implicit org.apache.kafka.common.serialization.Deserializer for the type V
the first message consumed from the given topic, with a type V)
KafkaUnavailableException
if unable to connect to Kafka
TimeoutException
if unable to consume a message within 5 seconds
Consumes the first message available in a given topic, deserializing it as type V.
Consumes the first message available in a given topic, deserializing it as type V.
Only the message that is returned is committed if autoCommit is false. If autoCommit is true then all messages that were polled will be committed.
the topic to consume a message from
if false, only the offset for the consumed message will be committed. if true, the offset for the last polled message will be committed instead. Defaulted to false.
an implicit EmbeddedKafkaConfig
an implicit org.apache.kafka.common.serialization.Deserializer for the type V
the first message consumed from the given topic, with a type V
KafkaUnavailableException
if unable to connect to Kafka
TimeoutException
if unable to consume a message within 5 seconds
Consumes the first n messages available in given topics, deserializes them as type V), and returns the n messages in a Map from topic name to List[(K, V)].
Consumes the first n messages available in given topics, deserializes them as type V), and returns the n messages in a Map from topic name to List[(K, V)].
Only the messages that are returned are committed if autoCommit is false. If autoCommit is true then all messages that were polled will be committed.
the topics to consume messages from
the number of messages to consume in a batch
if false, only the offset for the consumed messages will be committed. if true, the offset for the last polled message will be committed instead. Defaulted to false.
the interval to wait for messages before throwing TimeoutException
when true, throw TimeoutException if we have a silent period (no incoming messages) for the timeout interval; when false, throw TimeoutException after the timeout interval if we haven't received all of the expected messages
an implicit EmbeddedKafkaConfig
an implicit org.apache.kafka.common.serialization.Deserializer for the type K
an implicit org.apache.kafka.common.serialization.Deserializer for the type V
the List of messages consumed from the given topics, each with a type V)
KafkaUnavailableException
if unable to connect to Kafka
TimeoutException
if unable to consume messages within specified timeout
Consumes the first n messages available in given topics, deserializes them as type V, and returns the n messages in a Map from topic name to List[V].
Consumes the first n messages available in given topics, deserializes them as type V, and returns the n messages in a Map from topic name to List[V].
Only the messages that are returned are committed if autoCommit is false. If autoCommit is true then all messages that were polled will be committed.
the topics to consume messages from
the number of messages to consume in a batch
if false, only the offset for the consumed messages will be committed. if true, the offset for the last polled message will be committed instead. Defaulted to false.
the interval to wait for messages before throwing TimeoutException
when true, throw TimeoutException if we have a silent period (no incoming messages) for the timeout interval; when false, throw TimeoutException after the timeout interval if we haven't received all of the expected messages
an implicit EmbeddedKafkaConfig
an implicit org.apache.kafka.common.serialization.Deserializer for the type V
the List of messages consumed from the given topics, each with a type V
KafkaUnavailableException
if unable to connect to Kafka
TimeoutException
if unable to consume messages within specified timeout
Creates a topic with a custom configuration.
Creates a topic with a custom configuration.
the topic name
per topic configuration Map
number of partitions Int
replication factor Int
an implicit EmbeddedKafkaConfig
Returns whether the in memory servers are running.
Returns whether the in memory servers are running.
Publishes synchronously a message of type String to the running Kafka broker.
Publishes synchronously a message of type String to the running Kafka broker.
the topic to which publish the message (it will be auto-created)
the String message to publish
an implicit EmbeddedKafkaConfig
KafkaUnavailableException
if unable to connect to Kafka
Publishes synchronously a batch of message to the running Kafka broker.
Publishes synchronously a batch of message to the running Kafka broker.
the topic to which publish the message (it will be auto-created)
the keys and messages of type T) to publish
an implicit EmbeddedKafkaConfig
an implicit Serializer for the type K
an implicit Serializer for the type T
KafkaUnavailableException
if unable to connect to Kafka
Publishes synchronously a message to the running Kafka broker.
Publishes synchronously a message to the running Kafka broker.
the topic to which publish the message (it will be auto-created)
the key of type K to publish
the message of type T to publish
an implicit EmbeddedKafkaConfig
an implicit Serializer for the type T
KafkaUnavailableException
if unable to connect to Kafka
Publishes synchronously a message to the running Kafka broker.
Publishes synchronously a message to the running Kafka broker.
the producerRecord of type T to publish
an implicit EmbeddedKafkaConfig
an implicit Serializer for the type T
KafkaUnavailableException
if unable to connect to Kafka
Publishes synchronously a message to the running Kafka broker.
Publishes synchronously a message to the running Kafka broker.
the topic to which publish the message (it will be auto-created)
the message of type T to publish
an implicit EmbeddedKafkaConfig
an implicit Serializer for the type T
KafkaUnavailableException
if unable to connect to Kafka
Starts in memory servers, using temporary directories for storing logs.
Starts in memory servers, using temporary directories for storing logs. The log directories will be cleaned after calling the EmbeddedServer.stop() method or on JVM exit, whichever happens earlier.
an implicit EmbeddedKafkaConfig
Starts a Kafka broker in memory, storing logs in a specific location.
Starts a Kafka broker in memory, storing logs in a specific location.
the path for the Kafka logs
an EmbeddedZ server
an implicit EmbeddedKafkaConfig
an EmbeddedK server
Starts a Zookeeper instance in memory, storing logs in a specific location.
Starts a Zookeeper instance in memory, storing logs in a specific location.
the path for the Zookeeper logs
an implicit EmbeddedKafkaConfig
an EmbeddedZ server
Stops a specific EmbeddedServer instance, and deletes the log directory.
Stops a specific EmbeddedServer instance, and deletes the log directory.
the EmbeddedServer to be stopped.
Stops all in memory servers and deletes the log directories.
Stops all in memory servers and deletes the log directories.
Stops all in memory Kafka instances, preserving the logs directories.
Stops all in memory Kafka instances, preserving the logs directories.
Stops all in memory Zookeeper instances, preserving the logs directories.
Stops all in memory Zookeeper instances, preserving the logs directories.
Starts a ZooKeeper instance and a Kafka broker (and performs additional logic, if any), then executes the body passed as a parameter.
Starts a ZooKeeper instance and a Kafka broker (and performs additional logic, if any), then executes the body passed as a parameter.
the function to execute
an implicit EmbeddedKafkaConfig
Starts a ZooKeeper instance and a Kafka broker (and performs additional logic, if any), then executes the body passed as a parameter.
Starts a ZooKeeper instance and a Kafka broker (and performs additional logic, if any), then executes the body passed as a parameter. The actual ports of the servers will be detected and inserted into a copied version of the EmbeddedKafkaConfig that gets passed to body. This is useful if you set any port to 0, which will listen on an arbitrary available port.
the user-defined EmbeddedKafkaConfig
the function to execute, given an EmbeddedKafkaConfig with the actual ports the servers are running on