Camel Multicast issue -
we using below configuration send file single source multiple remote destinations.
<?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:camel="http://camel.apache.org/schema/spring" xmlns:util="http://www.springframework.org/schema/util" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> <routecontext id="gcgratesoutbound" xmlns="http://camel.apache.org/schema/spring"> <route id="gcgratesfileout"> <from uri="file:{{nas.root}}/{{gcg.out.prices.dir}}?delay={{poll.delay}}&initialdelay={{initial.delay}}&readlock=rename&scheduledexecutorservice=#scheduledexecutorservice" /> <multicast stoponexception="true"> <to uri="scp://{{gcg.ste.client1_user_name}}@{{gcg.ste.host_name}}:{{gcg.ste.port_number}}/{{gcg.ste.destination_client1}}?knownhostsfile={{ssh.knownhosts}}&privatekeyfile={{ssh.privatekey}}" /> <to uri="scp://{{gcg.ste.client2_user_name}}@{{gcg.ste.host_name}}:{{gcg.ste.port_number}}/{{gcg.ste.destination_client2}}?knownhostsfile={{ssh.knownhosts}}&privatekeyfile={{ssh.privatekey}}" /> <to uri="scp://{{gcg.ste.client3_user_name}}@{{gcg.ste.host_name}}:{{gcg.ste.port_number}}/{{gcg.ste.destination_client3}}?knownhostsfile={{ssh.knownhosts}}&privatekeyfile={{ssh.privatekey}}" /> </multicast> </route> </routecontext> </beans>
using above confirguration file reaches remote destinations, confirmed connection remote destinations successfull.
we need file should moved archive folder after file has been transfered remote destinations. , should move error folder incase of error.
however, when add archival code ( element) child element multicast element in above configuration , use , tag move file error folder incase of error. file not reach remote destinations.
<dotry> <multicast stoponexception="true" parallelprocessing="true"> <to uri="scp://{{gcg.ste.client1_user_name}}@{{gcg.ste.host_name}}:{{gcg.ste.port_number}}/{{gcg.ste.destination_client1}}?knownhostsfile={{ssh.knownhosts}}&privatekeyfile={{ssh.privatekey}}" /> <to uri="scp://{{gcg.ste.client2_user_name}}@{{gcg.ste.host_name}}:{{gcg.ste.port_number}}/{{gcg.ste.destination_client2}}?knownhostsfile={{ssh.knownhosts}}&privatekeyfile={{ssh.privatekey}}" /> <to uri="scp://{{gcg.ste.client3_user_name}}@{{gcg.ste.host_name}}:{{gcg.ste.port_number}}/{{gcg.ste.destination_client3}}?knownhostsfile={{ssh.knownhosts}}&privatekeyfile={{ssh.privatekey}}" /> <to uri="file://{{nas.root}}/{{gcg.out.prices.dir}}?filename={{archive.dir}}" /> </multicast> <docatch> <exception>java.lang.exception</exception> <handled> <constant>true</constant> </handled> <to uri="file://{{nas.root}}/{{gcg.out.prices.dir}}?filename={{error.dir}}" /> </docatch> </dotry>
the file not reach remote destinations nor produce log , file moved archive folder.
i tried placing remote destinations, archival code , move error code in seperate routes , have reference in single multicast below
<to uri="direct:client1fileout" /> <to uri="direct:client2fileout" /> <to uri="direct:client3fileout" /> <to uri="direct:movetoarchive" />
<route id="gcgfileout1"> <from uri="direct:client1fileout" /> <dotry> <to uri="scp://{{gcg.ste.client1_user_name}}@{{gcg.ste.host_name}}:{{gcg.ste.port_number}}/{{gcg.ste.destination_client1}}?knownhostsfile={{ssh.knownhosts}}&privatekeyfile={{ssh.privatekey}}" /> <docatch> <exception>java.lang.exception</exception> <handled> <constant>true</constant> </handled> <to uri="direct:gcgerror" /> </docatch> </dotry> </route>
however, file not reach remote destinations nor produce log , file moved archive folder.
i new camel.
i tried using shareunitofwork attribute below
<multicast shareunitofwork="true">
however, file moved archive folder along test_2_19082013_3.txt.camellock file
not sure why file moved archive when file dropped test_2_19082013_3.txt
also there folder named "archiv~1" created in drop location.
something might went wrong when moving file archive. have stoponexception="true" parallelprocessing="true"
, local file done first should fastest.
you want print error somewhere. now, catch exception , mark error handled. still expect logs. use log component , output log statements manually. not in case or error in case of success. can log in debug level can manually enable log outprint in case need - now.
another option figure out what's going on enable trace make less "blind".
that said debugging on own -
you archiving , storeing error messages in input directory. lock file see when camel reading. what's casuing application malfunction.
{{nas.root}}/{{gcg.out.prices.dir}}
the filename=...
filename, not sub directory.
so: file://{{nas.root}}/{{gcg.out.prices.dir}}/{{archive.dir}}
should (likewise error path).
Comments
Post a Comment