使用Apache Camel将6个文件聚合到单个文件中

时间:2015-04-30 09:34:01

标签: xml apache-camel camel-ftp

我有一个要求,我必须使用Apache Camel将6个xml文件聚合/合并到一个xml文件中。问题是,6个xml文件安装在一个文件夹上,该文件夹将对6个不同的服务器进行轮询。因此,如果每个服务器获取一个文件并锁定它,我怎么能合并并创建一个xml文件?

当有六台服务器处理安装到该文件夹​​的所有六个文件时,复杂性是如何写入单个文件。

如果有人遇到类似问题,请帮助解决。

由于

1 个答案:

答案 0 :(得分:0)

来自骆驼文档 http://camel.apache.org/file2.html

<div class="col-xs-9"align="left">
  <h3>Edit Position</h3>
</div>	
<div class="col-xs-12">
    <div class="row">
        <div class="col-xs-9">
            <div class="tabbable">
                <ul class="nav nav-tabs">
                    <li class="active"><a href="#pane1" data-toggle="tab">Details</a></li>
                </ul>
                <div class="tab-content">
                    <div id="pane1" class="tab-pane active">
                        <div class="well"> 
                            <fieldset> 
                                <label class="control-label" for="SN">S/N:	              		</label>
                                <div class="controls"><input id="SN" type="text" value="1605" class="form-control input-md" name="SN" disabled /></div>
                                <div class="pull-right"><input type="submit" id="SavePosition"  class="btn btn-success" value="Update Position" /></div>
                                <div class="pull-centered">
                                    <a class="btn btn-danger" data-target="#Delete"  ID="DeletePosButton" role="button" data-toggle="modal">Delete Position</a> 
                                </div>
                            </fieldset>
                        </div><!-- /.well -->
                    </div> <!-- panel -->
                </div><!-- tab -->
            </div><!-- tabable -->
        </div><!-- col -->
    </div><!-- row -->
<!-- modal window content, the id of the containing div must match the href on the toggle button -->
<div class="modal" id="RemoveCandidate" tabindex="-1" role="dialog" aria-hidden="true">
  <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="icon-remove"></i></button>
          <h3 id="modalLabel"><cfoutput>Remove the current assignment?</cfoutput></h3>
        </div>
        <div class="modal-body">
           <div class="well">
               <form action="#event.buildlink(rc.RemoveTourAssignment)#" id="dropposition" method="post">
                 <cfoutput>
                     <input id="pos_id" type="hidden" name="pos_id" value="#rc.pos_id#" />
                     <input id="ThetourID" type="hidden" name="ThetourID" value="0" /> 
                  </cfoutput>
                <fieldset>
                  Click anywhere outside of this window to cancel.
                  <div class="pull-right">
                      <input type="submit" id="removethisposition" class="btn btn-danger" value="Remove Assignment" />
                  </div>
                   </fieldset>
               </form>
            </div> <!-- end of well -->
          </div>
      </div>
    </div>
</div>


    <!-- modal window content, the id of the containing div must match the href on the toggle button -->
<div class="modal fade" id="Delete" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="icon-remove"></i></button>
                <h3 id="modalLabel">Delete position IP:a103 ?</h3>
            </div>
            <div class="modal-body">
                <div class="well">
                    <form action="" id="dropposition" method="post">
                        <input id="pos_id" type="hidden" name="pos_id" value="1605" />
                        <input id="ftfIPNumber" type="hidden" name="ftfIPNumber" value="a103" />
                        <fieldset>
                            Click anywhere outside of this window to cancel.
                              <div class="pull-right">
                                  <input type="submit" id="deletethisposition" class="btn btn-danger" value="Delete Position" />
                              </div>
                           </fieldset>
                    </form>
                </div> <!-- end of well -->
            </div>
        </div>
    </div>
    </div>

  

所以这应该有助于文件锁定方案。

现在进行下一步,可以使用aggregationrepository实现自定义聚合策略,这样消费者就是幂等的。