Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/bump kafka version #58

Merged
merged 4 commits into from
Dec 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Allows you to start and stop a Kafka broker + ZooKeeper instance for unit testin
## Versions
| kafka-unit | Kafka broker | Zookeeper |
|------------|-------------------------|-----------|
| 1.0 | kafka_2.11:0.11.0.0 | 3.4.10 |
| 0.7 | kafka_2.11:0.10.0.2 | 3.4.10 |
| 0.6 | kafka_2.11:0.10.0.0 | 3.4.6 |
| 0.5 | kafka_2.11:0.9.0.1 | 3.4.6 |
Expand All @@ -20,7 +21,7 @@ Allows you to start and stop a Kafka broker + ZooKeeper instance for unit testin
<dependency>
<groupId>info.batey.kafka</groupId>
<artifactId>kafka-unit</artifactId>
<version>0.7</version>
<version>1.0</version>
</dependency>
```

Expand Down Expand Up @@ -52,14 +53,15 @@ You can then write your own code to interact with Kafka or use the following met

```java
kafkaUnitServer.createTopic(testTopic);
KeyedMessage<String, String> keyedMessage = new KeyedMessage<>(testTopic, "key", "value");
ProducerRecord<String, String> keyedMessage = new ProducerRecord<>(testTopic, "key", "value");
kafkaUnitServer.sendMessages(keyedMessage);
```

And to read messages:

```java
List<String> messages = kafkaUnitServer.readMessages(testTopic, 1);
List<String> allMessages = kafkaUnitServer.readAllMessages(testTopic);
```

Only `String` messages are supported at the moment.
Expand Down Expand Up @@ -89,9 +91,9 @@ public class KafkaUnitIntegrationTest {
public void junitRuleShouldHaveStartedKafka() throws Exception {
String testTopic = "TestTopic";
kafkaUnitRule.getKafkaUnit().createTopic(testTopic);
KeyedMessage<String, String> keyedMessage = new KeyedMessage<>(testTopic, "key", "value");
ProducerRecord<String, String> keyedMessage = new ProducerRecord<>(testTopic, "key", "value");

kafkaUnitRule.getKafkaUnit().sendMessages(keyedMessage);
kafkaUnitServer.sendMessages(keyedMessage);
List<String> messages = kafkaUnitRule.getKafkaUnit().readMessages(testTopic, 1);

assertEquals(Arrays.asList("value"), messages);
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ repositories {

dependencies {
compile 'junit:junit:4.11'
compile('org.apache.kafka:kafka_2.11:0.10.2.0') {
compile('org.apache.kafka:kafka_2.11:0.11.0.0') {
exclude module: 'slf4j-simple'
exclude module: 'slf4j-log4j12'
exclude module: 'jmxtools'
Expand Down
Loading