<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:amq="http://activemq.apache.org/schema/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">

	<!-- JmsTemplate Definition -->
	<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
		<property name="connectionFactory" ref="connectionFactory" />
		<property name="defaultDestination" ref="destinationQueue" />
		<property name="messageConverter" ref="myMessageConverter" />
	</bean>
	<bean id="amqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
		<constructor-arg index="0" value="tcp://localhost:61616" />
	</bean>

	<!-- ConnectionFactory Definition -->
	<bean id="connectionFactory"
		class="org.springframework.jms.connection.SingleConnectionFactory">
		<constructor-arg ref="amqConnectionFactory" />

	</bean>


	<bean id="destinationQueue" class="org.apache.activemq.command.ActiveMQQueue">
		<constructor-arg index="0" value="IN_QUEUE" />
	</bean>


	<bean id="SampleJmsMessageSender" class="com.baeldung.spring.jms.SampleJmsMessageSender">
		<property name="queue" ref="destinationQueue" />
		<property name="jmsTemplate" ref="jmsTemplate" />
	</bean>

	<bean id="myMessageConverter" class="com.baeldung.spring.jms.SampleMessageConverter" />

	<!-- this is the Message-Driven POJO (MDP) -->
	<bean id="messageListener" class="com.baeldung.spring.jms.SampleListener">
		<property name="jmsTemplate" ref="jmsTemplate" />
		<property name="queue" ref="destinationQueue" />
	</bean>


	<!-- and this is the message listener container -->
	<bean id="jmsContainer"
		class="org.springframework.jms.listener.DefaultMessageListenerContainer">
		<property name="connectionFactory" ref="connectionFactory" />
		<property name="destinationName" value="IN_QUEUE" />
		<property name="messageListener" ref="messageListener" />
	</bean>
</beans>
