Camel Multicast issue
We are using the below configuration to send a file from single source to
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 the above confirguration the file reaches the remote destinations,
which confirmed that the connection to all the remote destinations were
successfull.
We need that the file should be moved to the archive folder after the file
has been successfully transfered to all the remote destinations. And
should move to error folder incase of any error.
However, when I add the archival code ( element) as child element to the
multicast element in the above configuration and use the and the tag to
move the file to error folder incase of an error. The file does not reach
the 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 does not reach the remote destinations nor does it produce any
log and the file is moved to archive folder.
I tried placing the remote destinations, the archival code and the move to
error code in seperate routes and have its reference in a single multicast
as 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, The file does not reach the remote destinations nor does it
produce any log and the file is moved to archive folder.
I am new to camel.
I tried using the shareUnitOfWork attribute as below
<multicast shareUnitOfWork="true">
However, the file moved to archive folder along with
Test_2_19082013_3.txt.camelLock file
Not sure why this file is also moved to archive when the file dropped was
Test_2_19082013_3.txt
Also there is folder named "ARCHIV~1" created in the drop location.
No comments:
Post a Comment