1 Reply Latest reply on Nov 13, 2013 8:51 AM by kcbabo

    How to process a set of files in the same Transaction

    buehlmann

      Hi,

       

      I would like to process a set of files which belong together in the same Transaction. The correlation identifier of the files which belong together can be derived from the filename. As a first approach I tried to read the files from a service with a File-Binding and then aggregate them in a Camel-Component with a custom AggregationStrategy. The Strategy aggregates the single Files of the incoming Exchanges to a List of Files (List<File>) in the new Exchange. The disadvantage of this approach is that each file will be processed in a seperate Transactions before the aggregation.

       

      Any other ideas to solve this problem with Switchyard and Camel?

       

      Best regards,

      Ben

        • 1. Re: How to process a set of files in the same Transaction
          kcbabo

          You could spilt this up into two routes:

           

          Route 1 : receive individual files and aggregate into a single file

          Route 2 : receive aggregated single file and perform processing

           

          This separates the concerns of batching/correlating the individual files and the actual processing logic for dealing with a batched input.  You know that the input to route 2 will always be processed as a single unit.  Any failures in route 1 related to receive/aggregation are isolated and can be dealt with separately.