spring - logging the messages of queue to a text file -


i have below spring integration xml in send message queue , message consumed , displayed on console want customize lets message consumed should written (in other words messages need logged)in text file , text file should saved in c: drive of folder name of file messageslog.txt

please advise how can add such functionality in spring integration acheieve functionality have come know in spring integration file outbound channel adapter help

below spring integtaion xml

<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans"     xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:int="http://www.springframework.org/schema/integration"     xmlns:jms="http://www.springframework.org/schema/integration/jms"     xmlns:context="http://www.springframework.org/schema/context"     xsi:schemalocation="http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-3.0.xsd             http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd             http://www.springframework.org/schema/integration/jms http://www.springframework.org/schema/integration/jms/spring-integration-jms-2.0.xsd             http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd             http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">      <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">tcp://labc.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> 

  • change input <publish-subscribe-channel/>
  • set order="1" on jms outbound channel adapter
  • subscribe file outbound channel adapter (mode=append) order="2"

by default, file adapter invoked if send jms successful.

you don't seem have consumer on output; however, avoid message loss, output should not queuechannel, remove <queue/> element (and don't need poller).


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -