Skip to content

Commit e6cfa22

Browse files
committed
Improved documentation and updated for release 0.3.0. Also, consumer group id carries now the suite id
1 parent 7465a8f commit e6cfa22

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Inspired by https://github.com/chbatey/kafka-unit
77

88
scalatest-embedded-kafka is available on Bintray and Maven Central, compiled for both Scala 2.10 and 2.11
99

10-
* In your `build.sbt` file add the following dependency: `"org.scalatest" %% "scalatest" % "0.2.3"`
10+
* In your `build.sbt` file add the following dependency: `"org.scalatest" %% "scalatest" % "0.3.0"`
1111
* Have your `Spec` extend the `EmbeddedKafka` trait.
1212
* Enclose the code that needs a running instance of Kafka within the `withRunningKafka` closure.
1313

@@ -41,11 +41,14 @@ It's possible to change the ports on which Zookeeper and Kafka are started by pr
4141
4242
## Utility methods
4343

44-
The `EmbeddedKafka` trait provides also an utility method to publish a message to a topic:
44+
The `EmbeddedKafka` trait provides also some utility methods to interact with the embedded kafka, in order to set preconditions or verifications in your specs:
4545

46-
publishToKafka("topic", "message")
46+
def publishToKafka(topic: String, message: String): Unit
4747
48-
At the moment it's only possible to publish a message as a `String`. There's no utility method for consuming, but this will be part of a next release.
48+
def consumeFirstMessageFrom(topic: String): String
49+
50+
51+
For more information about how to use those method, you can either look at the Scaladocs or at the tests of this project.
4952

5053
## Badges
5154

src/main/scala/net/manub/embeddedkafka/EmbeddedKafka.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ trait EmbeddedKafka {
8686
@throws(classOf[KafkaUnavailableException])
8787
def consumeFirstMessageFrom(topic: String)(implicit config: EmbeddedKafkaConfig): String = {
8888
val props = new Properties()
89-
props.put("group.id", "scalatest-embedded-kafka-spec")
89+
props.put("group.id", s"embedded-kafka-spec-$suiteId")
9090
props.put("zookeeper.connect", s"localhost:${config.zooKeeperPort}")
9191
props.put("auto.offset.reset", "smallest")
9292
props.put("zookeeper.connection.timeout.ms", "6000")

0 commit comments

Comments
 (0)