Updated ApplicationContext.xml

This commit is contained in:
Kiran 2016-10-09 13:58:30 -04:00 committed by GitHub
parent d1bdfb5234
commit 0af6fbea16
1 changed files with 22 additions and 12 deletions

View File

@ -3,16 +3,27 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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.xsd"> xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="messageDestination" class="org.apache.activemq.command.ActiveMQQueue"> <bean id="amqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<constructor-arg value="messageQueue1" /> <constructor-arg index="0" value="tcp://localhost:61616" />
</bean>
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory" />
<property name="receiveTimeout" value="10000" />
</bean> </bean>
<!-- ConnectionFactory Definition -->
<bean id="connectionFactory"
class="org.springframework.jms.connection.CachingConnectionFactory">
<constructor-arg ref="amqConnectionFactory" />
</bean>
<bean id="destinationQueue" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg index="0" value="IN_QUEUE" />
</bean>
<!-- JmsTemplate Definition -->
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory" />
<property name="defaultDestination" ref="destinationQueue" />
</bean>
<bean id="SampleJmsMessageSender" class="com.baeldung.spring.jms.SampleJmsMessageSender"> <bean id="SampleJmsMessageSender" class="com.baeldung.spring.jms.SampleJmsMessageSender">
<property name="destination" ref="messageDestination" /> <property name="queue" ref="destinationQueue" />
<property name="jmsTemplate" ref="jmsTemplate" /> <property name="jmsTemplate" ref="jmsTemplate" />
</bean> </bean>
@ -23,8 +34,7 @@
<bean id="jmsContainer" <bean id="jmsContainer"
class="org.springframework.jms.listener.DefaultMessageListenerContainer"> class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="connectionFactory" /> <property name="connectionFactory" ref="connectionFactory" />
<property name="destination" ref="messageDestination" /> <property name="destinationName" value="IN_QUEUE" />
<property name="messageListener" ref="messageListener" /> <property name="messageListener" ref="messageListener" />
<property name="jmsTemplate" ref="jmsTemplate" />
</bean> </bean>
</beans> </beans>