diff spring-jms-playground/src/main/java/de/comline/jms/receiver/QueueReceiver.java @ 17:a9675808f1dd

Triggern der exception je nach Payload
author Dirk Olmes <dirk.olmes@codedo.de>
date Thu, 10 Sep 2020 11:18:13 +0200
parents 4217059d40e8
children
line wrap: on
line diff
--- a/spring-jms-playground/src/main/java/de/comline/jms/receiver/QueueReceiver.java	Thu Sep 10 09:32:21 2020 +0200
+++ b/spring-jms-playground/src/main/java/de/comline/jms/receiver/QueueReceiver.java	Thu Sep 10 11:18:13 2020 +0200
@@ -19,7 +19,12 @@
 	}
 
 	@JmsListener(destination = "validated", containerFactory = Application.AMQ_FACTORY_BEAN)
-	public void receive(TextMessage message) {
+	public void receive(TextMessage message) throws Exception {
 		LOG.info("received message {}", message);
+
+		String text = message.getText();
+		if (text.contains("kaputt")) {
+			throw new IllegalStateException("Die Nachricht ist kaputt");
+		}
 	}
 }