Skip to content

Commit

Permalink
Remove sleep(1) from async retry test.
Browse files Browse the repository at this point in the history
  • Loading branch information
chickenchickenlove committed Oct 11, 2024
1 parent 3f6b447 commit 01de80e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 132 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,6 @@ static class FirstTopicListener {
public CompletableFuture<Void> listen(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) String receivedTopic) {
return CompletableFuture.supplyAsync(() -> {
container.countDownLatch1.countDown();
try {
Thread.sleep(1);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
throw new RuntimeException("Woooops... in topic " + receivedTopic);
});
}
Expand All @@ -358,12 +352,6 @@ static class SecondTopicListener {
public CompletableFuture<Void> listenAgain(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) String receivedTopic) {
return CompletableFuture.supplyAsync(() -> {
container.countDownIfNotKnown(receivedTopic, container.countDownLatch2);
try {
Thread.sleep(1);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
throw new IllegalStateException("Another woooops... " + receivedTopic);
});
}
Expand Down Expand Up @@ -391,12 +379,6 @@ static class ThirdTopicListener {
public CompletableFuture<Void> listenWithAnnotation(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) String receivedTopic) {
return CompletableFuture.supplyAsync(() -> {
container.countDownIfNotKnown(receivedTopic, container.countDownLatch3);
try {
Thread.sleep(1);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
throw new MyRetryException("Annotated woooops... " + receivedTopic);
});
}
Expand All @@ -420,12 +402,6 @@ static class FourthTopicListener {
public CompletableFuture<Void> listenNoDlt(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) String receivedTopic) {
return CompletableFuture.supplyAsync(() -> {
container.countDownIfNotKnown(receivedTopic, container.countDownLatch4);
try {
Thread.sleep(1);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
throw new IllegalStateException("Another woooops... " + receivedTopic);
});
}
Expand Down Expand Up @@ -472,12 +448,6 @@ public CompletableFuture<Void> listenWithAnnotation(String message, @Header(Kafk
this.topics.add(receivedTopic);
return CompletableFuture.supplyAsync(() -> {
container.countDownIfNotKnown(receivedTopic, container.countDownLatch51);
try {
Thread.sleep(1);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
throw new RuntimeException("Annotated woooops... " + receivedTopic);
});
}
Expand Down Expand Up @@ -505,12 +475,6 @@ public CompletableFuture<Void> listenWithAnnotation2(String message, @Header(Kaf
this.topics.add(receivedTopic);
return CompletableFuture.supplyAsync(() -> {
container.countDownLatch52.countDown();
try {
Thread.sleep(1);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
throw new RuntimeException("Annotated woooops... " + receivedTopic);
});
}
Expand All @@ -537,12 +501,6 @@ public CompletableFuture<Void> listenNoDlt(
@SuppressWarnings("unused") Acknowledgment ack) {
return CompletableFuture.supplyAsync(() -> {
container.countDownIfNotKnown(receivedTopic, container.countDownLatch6);
try {
Thread.sleep(1);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
throw new IllegalStateException("Another woooops... " + receivedTopic);
});
}
Expand All @@ -566,12 +524,6 @@ static class NoRetryTopicListener {
public CompletableFuture<Object> listenWithAnnotation2(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) String receivedTopic) {
return CompletableFuture.supplyAsync(() -> {
container.countDownIfNotKnown(receivedTopic, container.countDownLatchNoRetry);
try {
Thread.sleep(1);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
throw new MyDontRetryException("Annotated second woooops... " + receivedTopic);
});
}
Expand Down Expand Up @@ -601,12 +553,6 @@ public CompletableFuture<Void> listen1(String message, @Header(KafkaHeaders.RECE
this.topics.add(receivedTopic);
return CompletableFuture.supplyAsync(() -> {
container.countDownLatchReuseOne.countDown();
try {
Thread.sleep(1);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
throw new RuntimeException("Another woooops... " + receivedTopic);
});
}
Expand All @@ -632,12 +578,6 @@ public CompletableFuture<Void> listen2(String message, @Header(KafkaHeaders.RECE
this.topics.add(receivedTopic);
return CompletableFuture.supplyAsync(() -> {
container.countDownLatchReuseTwo.countDown();
try {
Thread.sleep(1);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
throw new RuntimeException("Another woooops... " + receivedTopic);
});
}
Expand All @@ -659,12 +599,6 @@ public CompletableFuture<Void> listen3(String message, @Header(KafkaHeaders.RECE
this.topics.add(receivedTopic);
return CompletableFuture.supplyAsync(() -> {
container.countDownLatchReuseThree.countDown();
try {
Thread.sleep(1);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
throw new RuntimeException("Another woooops... " + receivedTopic);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,6 @@ public Mono<Void> listen(
@Header(KafkaHeaders.RECEIVED_TOPIC) String receivedTopic) {
return Mono.fromCallable(() -> {
container.countDownLatch1.countDown();
try {
Thread.sleep(1);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
throw new RuntimeException("Woooops... in topic " + receivedTopic);
}).then();
}
Expand All @@ -360,12 +354,6 @@ public Mono<Void> listenAgain(
@Header(KafkaHeaders.RECEIVED_TOPIC) String receivedTopic) {
return Mono.fromCallable(() -> {
container.countDownIfNotKnown(receivedTopic, container.countDownLatch2);
try {
Thread.sleep(1);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
throw new IllegalStateException("Another woooops... " + receivedTopic);
}).then();
}
Expand Down Expand Up @@ -395,12 +383,6 @@ public Mono<Void> listenWithAnnotation(
@Header(KafkaHeaders.RECEIVED_TOPIC) String receivedTopic) {
return Mono.fromCallable(() -> {
container.countDownIfNotKnown(receivedTopic, container.countDownLatch3);
try {
Thread.sleep(1);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
throw new MyRetryException("Annotated woooops... " + receivedTopic);
}).then();
}
Expand All @@ -426,12 +408,6 @@ public Mono<Void> listenNoDlt(
@Header(KafkaHeaders.RECEIVED_TOPIC) String receivedTopic) {
return Mono.fromCallable(() -> {
container.countDownIfNotKnown(receivedTopic, container.countDownLatch4);
try {
Thread.sleep(1);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
throw new IllegalStateException("Another woooops... " + receivedTopic);
}).then();
}
Expand Down Expand Up @@ -478,12 +454,6 @@ public Mono<Void> listenWithAnnotation(String message, @Header(KafkaHeaders.RECE
this.topics.add(receivedTopic);
return Mono.fromCallable(() -> {
container.countDownIfNotKnown(receivedTopic, container.countDownLatch51);
try {
Thread.sleep(1);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
throw new RuntimeException("Annotated woooops... " + receivedTopic);
}).then();
}
Expand Down Expand Up @@ -511,12 +481,6 @@ public Mono<Void> listenWithAnnotation2(String message, @Header(KafkaHeaders.REC
this.topics.add(receivedTopic);
return Mono.fromCallable(() -> {
container.countDownLatch52.countDown();
try {
Thread.sleep(1);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
throw new RuntimeException("Annotated woooops... " + receivedTopic);
}).then();
}
Expand All @@ -543,12 +507,6 @@ public Mono<Void> listenNoDlt(
@SuppressWarnings("unused") Acknowledgment ack) {
return Mono.fromCallable(() -> {
container.countDownIfNotKnown(receivedTopic, container.countDownLatch6);
try {
Thread.sleep(1);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
throw new IllegalStateException("Another woooops... " + receivedTopic);
}).then();
}
Expand All @@ -572,12 +530,6 @@ static class NoRetryTopicListener {
public Mono<Void> listenWithAnnotation2(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) String receivedTopic) {
return Mono.fromCallable(() -> {
container.countDownIfNotKnown(receivedTopic, container.countDownLatchNoRetry);
try {
Thread.sleep(1);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
throw new MyDontRetryException("Annotated second woooops... " + receivedTopic);
}).then();
}
Expand Down Expand Up @@ -607,12 +559,6 @@ public Mono<Void> listen1(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) S
this.topics.add(receivedTopic);
return Mono.fromCallable(() -> {
container.countDownLatchReuseOne.countDown();
try {
Thread.sleep(1);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
throw new RuntimeException("Another woooops... " + receivedTopic);
}).then();
}
Expand All @@ -638,12 +584,6 @@ public Mono<Void> listen2(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) S
this.topics.add(receivedTopic);
return Mono.fromCallable(() -> {
container.countDownLatchReuseTwo.countDown();
try {
Thread.sleep(1);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
throw new RuntimeException("Another woooops... " + receivedTopic);
}).then();
}
Expand All @@ -665,12 +605,6 @@ public Mono<Void> listen3(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) S
this.topics.add(receivedTopic);
return Mono.fromCallable(() -> {
container.countDownLatchReuseThree.countDown();
try {
Thread.sleep(1);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
throw new RuntimeException("Another woooops... " + receivedTopic);
}).then();
}
Expand Down

0 comments on commit 01de80e

Please sign in to comment.