You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-1Lines changed: 23 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,20 @@ scalatest-embedded-kafka is available on Bintray and Maven Central, compiled for
23
23
24
24
* In-memory Zookeeper and Kafka will be instantiated respectively on port 6000 and 6001 and automatically shutdown at the end of the test.
25
25
26
+
### Use without the `withRunningKafka` method
27
+
28
+
A `EmbeddedKafka` companion object is provided for usage without the `EmbeddedKafka` trait. Zookeeper and Kafka can be started an stopped in a programmatic way.
29
+
30
+
class MySpec extends WordSpec {
31
+
32
+
"runs with embedded kafka" should {
33
+
34
+
withRunningKafka {
35
+
// ... code goes here
36
+
}
37
+
38
+
}
39
+
26
40
## Configuration
27
41
28
42
It's possible to change the ports on which Zookeeper and Kafka are started by providing an implicit `EmbeddedKafkaConfig`
@@ -39,6 +53,8 @@ It's possible to change the ports on which Zookeeper and Kafka are started by pr
39
53
40
54
}
41
55
56
+
This works for both `withRunningKafka` and `EmbeddedKafka.start()`
57
+
42
58
## Utility methods
43
59
44
60
The `EmbeddedKafka` trait provides also some utility methods to interact with the embedded kafka, in order to set preconditions or verifications in your specs:
@@ -47,8 +63,14 @@ The `EmbeddedKafka` trait provides also some utility methods to interact with th
0 commit comments