Vorlage errorhandling/spring-consumer--json--adder--vorlage
authorKai Moritz <kai@juplo.de>
Sat, 19 Nov 2022 16:04:47 +0000 (17:04 +0100)
committerKai Moritz <kai@juplo.de>
Sun, 18 Jun 2023 10:32:45 +0000 (12:32 +0200)
README.sh
src/main/java/de/juplo/kafka/SimpleConsumer.java

index d63d229..7bcc996 100755 (executable)
--- a/README.sh
+++ b/README.sh
@@ -34,20 +34,13 @@ while ! [[ $(http 0:8080/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Wait
 while ! [[ $(http 0:8081/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for consumer-1..."; sleep 1; done
 while ! [[ $(http 0:8082/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for consumer-2..."; sleep 1; done
 
-# tag::nachrichten[]
 echo 6  | http -v :8080/peter
 echo 77 | http -v :8080/klaus
-# end::nachrichten[]
 
 echo "Writing logic error..."
-# tag::logicerror[]
 echo 66 | http -v :8080/peter?error=1
-# end::logicerror[]
 echo 7  | http -v :8080/klaus
 
+sleep 5
+docker-compose -f docker/docker-compose.yml stop consumer-1 consumer-2
 docker-compose -f docker/docker-compose.yml logs -f consumer-1 consumer-2
-
-echo "Restarting consumer-1..."
-# tag::restart[]
-docker-compose -f docker/docker-compose.yml up consumer-1
-# end::restart[]
index cea9568..82d6794 100644 (file)
@@ -56,8 +56,7 @@ public class SimpleConsumer implements Callable<Integer>
     }
     catch(Exception e)
     {
-      log.error("{} - Unexpected error: {}, unsubscribing!", id, e.toString());
-      consumer.unsubscribe();
+      log.error("{} - Unexpected error: {}!", id, e.toString());
       return 1;
     }
     finally