You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Mdmshri <sh...@gmail.com> on 2015/05/05 07:27:49 UTC

Merging xml files generated on different servers

Hi All,

I am working on unique requirement where i have to merge xml files generated
on 6 different servers. Same application war is running on 6 different
servers. Each war deployed generates one xml output file on that particular
server, this way i have 6 files all together but each on separate box. Now,
i have to write aggregation logic to merge these 6 xml files to single file. 

I tried one POC and if all 6 files are available on single server, i am able
to aggregate files using below : 

<route id="fileAggregatorRoute">
			<from
uri="file://{{input.dir.path}}?move={{archive.dir.path}}/inbox&amp;maxMessagesPerPoll=1&amp;delay=6000"
/>
			<camel:aggregate completionSize="6" strategyRef="xmlAggregationStrategy"
forceCompletionOnStop="true">
				<camel:correlationExpression>
					<constant>true</constant>
				</camel:correlationExpression>
			<camel:to
uri="file://{{archive.dir.path}}/output/?fileExist=Append&amp;fileName=MergedXml_$simple{date:now:yyyyMMdd}_$simple{date:now:HHmmss}.xml"
/>
			</camel:aggregate>
		</route>

Now, instead of generating file on specific server, each server can write to
single file on share/mounted directory by checking fileExist=Append, this
way it will append to existing instead of creating new file each time. 
Problem start here: once this file is generated i have to FTP it to other
server. 
    1. How to make sure that all 6 servers has finished writing to single
file because once one server will finish with file writing route, it will
follow with ftp route and that server will try to ftp file which other
server would be writing to.
    2. How to make sure that once writing process is completed by 6 servers,
only one server has to start FTP process since all 6 servers have same war
deployed. So, all servers might try to ftp same file.

Thanks!!




--
View this message in context: http://camel.465427.n5.nabble.com/Merging-xml-files-generated-on-different-servers-tp5766702.html
Sent from the Camel - Users mailing list archive at Nabble.com.