# HG changeset patch # User Dirk Olmes # Date 1599723141 -7200 # Node ID 4217059d40e85521d101417d933d30f156940b0b # Parent ad77abd85976a7cc8f8bfd3166b739e002440bfe Test zum Empfang einer ganzen JMS Message, nicht nur der Payload diff -r ad77abd85976 -r 4217059d40e8 spring-jms-playground/src/main/java/de/comline/jms/application/Application.java --- a/spring-jms-playground/src/main/java/de/comline/jms/application/Application.java Thu Sep 10 08:44:20 2020 +0200 +++ b/spring-jms-playground/src/main/java/de/comline/jms/application/Application.java Thu Sep 10 09:32:21 2020 +0200 @@ -20,6 +20,8 @@ @Import(AppConfig.class) public class Application { private static final Logger LOG = LoggerFactory.getLogger(Application.class); + + public static final String AMQ_FACTORY_BEAN = "amqFactory"; public static void main(String[] args) { SpringApplication.run(Application.class, args); @@ -28,7 +30,7 @@ @Configuration @Import({ ActiveMQAutoConfiguration.class, JmsAutoConfiguration.class, QueueReceiver.class }) public static class AppConfig { - @Bean(name = "amqFactory") + @Bean(name = AMQ_FACTORY_BEAN) public JmsListenerContainerFactory configureJmsListenerFactory(ConnectionFactory connectionFactory, DefaultJmsListenerContainerFactoryConfigurer configurer) { DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory(); diff -r ad77abd85976 -r 4217059d40e8 spring-jms-playground/src/main/java/de/comline/jms/receiver/QueueReceiver.java --- a/spring-jms-playground/src/main/java/de/comline/jms/receiver/QueueReceiver.java Thu Sep 10 08:44:20 2020 +0200 +++ b/spring-jms-playground/src/main/java/de/comline/jms/receiver/QueueReceiver.java Thu Sep 10 09:32:21 2020 +0200 @@ -1,16 +1,25 @@ package de.comline.jms.receiver; +import javax.jms.TextMessage; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.jms.annotation.JmsListener; import org.springframework.stereotype.Component; +import de.comline.jms.application.Application; + @Component public class QueueReceiver { private static final Logger LOG = LoggerFactory.getLogger(QueueReceiver.class); - @JmsListener(destination = "input-queue", containerFactory = "amqFactory") + @JmsListener(destination = "input-queue", containerFactory = Application.AMQ_FACTORY_BEAN) public void receive(String message) { LOG.info("received {}", message); } + + @JmsListener(destination = "validated", containerFactory = Application.AMQ_FACTORY_BEAN) + public void receive(TextMessage message) { + LOG.info("received message {}", message); + } }