<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:jee="http://www.springframework.org/schema/jee"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc.xsd
        http://www.springframework.org/schema/jee
        http://www.springframework.org/schema/jee/spring-jee.xsd">


    <jee:jndi-lookup id="connectionFactory" jndi-name="java:comp/env/jms/connectionFactory" />
    <jee:jndi-lookup id="InputQueue" jndi-name="java:comp/env/jms/InputQueue" />

    <bean id="InputListener" class="org.apache.activemq.artemis.example.tomcat.sample.SystemOutPrintLnMessageListener" />
    
    <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate" >
        <property name="connectionFactory">
            <bean class="org.springframework.jms.connection.CachingConnectionFactory" >
                <property name="targetConnectionFactory" ref="connectionFactory" />
            </bean>
        </property>
        <property name="defaultDestination" ref="InputQueue" />
    </bean>
    
    <bean id="messageListenerContainer"
          class="org.springframework.jms.listener.DefaultMessageListenerContainer">
        <property name="connectionFactory" ref="connectionFactory" />
        <property name="destination" ref="InputQueue" />
        <property name="messageListener" ref="InputListener" />
    </bean>
</beans>