SimpleProducer instanceA = new SimpleProducer(
bootstrapServers,
TOPIC,
- "A");
- SimpleProducer instanceB = new SimpleProducer(
- bootstrapServers,
- TOPIC,
- "B");
+ "FOO");
instanceA.begin();
- CompletableFuture<Long> resultA1 = instanceA.send("a","message #1");
+ CompletableFuture<Long> resultA1 = instanceA.send("foo","message #1");
await("Sending of 1. message for A is completed")
.atMost(Duration.ofSeconds(5))
.until(() -> resultA1.isDone());
Assertions.assertThat(resultA1.isCompletedExceptionally()).isFalse();
+ SimpleProducer instanceB = new SimpleProducer(
+ bootstrapServers,
+ TOPIC,
+ "FOO");
+
instanceB.begin();
- CompletableFuture<Long> resultB1 = instanceB.send("b","message #1");
+ CompletableFuture<Long> resultB1 = instanceB.send("foo","message #1");
await("Sending of 1. message for B is completed")
.atMost(Duration.ofSeconds(5))
.until(() -> resultB1.isDone());
Assertions.assertThat(resultB1.isCompletedExceptionally()).isFalse();
- CompletableFuture<Long> resultA2 = instanceA.send("a","message #2");
+ CompletableFuture<Long> resultA2 = instanceA.send("foo","message #2");
await("Sending of 2. message for A is completed")
.atMost(Duration.ofSeconds(5))
.until(() -> resultA2.isDone());
- // Assertions.assertThat(resultA2.isCompletedExceptionally()).isTrue();
- Assertions.assertThat(resultA2.isCompletedExceptionally()).isFalse();
+ Assertions.assertThat(resultA2.isCompletedExceptionally()).isTrue();
- CompletableFuture<Long> resultB2 = instanceB.send("b","message #2");
+ CompletableFuture<Long> resultB2 = instanceB.send("foo","message #2");
await("Sending of 2. message for B is completed")
.atMost(Duration.ofSeconds(5))
.until(() -> resultB2.isDone());