I have an below spring integration xml in which I send an message to queue and that message is consumed finally and displayed on console but now I want to customize it lets say those message which are consumed should be finally written (in other words those messages need to be logged)in a text file and that text file should be saved in C: drive of my folder the name of the file is messageslog.txt
Please advise how can I add such functionality in spring integration itself to acheieve this functionality I have come to know that in spring integration something like file outbound channel adapter will help
below is my spring integtaion xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://ift.tt/GArMu6"
xmlns:xsi="http://ift.tt/ra1lAU" xmlns:int="http://ift.tt/1eF5VEE"
xmlns:jms="http://ift.tt/TAOyvj"
xmlns:context="http://ift.tt/GArMu7"
xsi:schemaLocation="http://ift.tt/1iMF6wC http://ift.tt/1ofECj3
http://ift.tt/1eF5VEE http://ift.tt/TAOyvn
http://ift.tt/TAOyvj http://ift.tt/1reKI9Q
http://ift.tt/GArMu6 http://ift.tt/QEDs1e
http://ift.tt/GArMu7 http://ift.tt/QEDs1k">
<int:poller id="poller" default="true">
<int:interval-trigger interval="200" />
</int:poller>
<int:channel id="output">
<int:queue capacity="10" />
</int:channel>
<bean id="tibcoEMSJndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">com.tibco.tibjms.naming.TibjmsInitialContextFactory</prop>
<prop key="java.naming.provider.url">http://tcplabc.net:7033</prop>
<prop key="java.naming.security.principal">wer</prop>
<prop key="java.naming.security.credentials">wer</prop>
</props>
</property>
</bean>
<bean id="tibcoEMSConnFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate">
<ref bean="tibcoEMSJndiTemplate" />
</property>
<property name="jndiName">
<value>GenericConnectionFactory</value>
</property>
</bean>
<bean id="tibcosendJMSTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory">
<ref local="tibcoEMSConnFactory" />
</property>
<property name="defaultDestinationName">
<value>test.data</value>
</property>
<property name="pubSubDomain">
<value>false</value>
</property>
<property name="receiveTimeout">
<value>120000</value>
</property>
</bean>
<int:channel id="input">
</int:channel>
<jms:outbound-channel-adapter channel="input"
destination-name="test.data" connection-factory="tibcoEMSConnFactory" />
<jms:message-driven-channel-adapter
channel="output" destination-name="test.data" connection-factory="tibcoEMSConnFactory" />
</beans>
Aucun commentaire:
Enregistrer un commentaire