Results 1 to 3 of 3

Thread: How would you design md5 file validation with spring integration ?

  1. #1
    Join Date
    Jun 2011
    Posts
    2

    Default How would you design md5 file validation with spring integration ?

    Hi all,

    I am currently working on the refactoring of file management project, and I wonder if spring integration could help me.
    I plan to use an inbound channel adapter to receive file through FTP, which is polled every 10 seconds.
    Files are can be of 2 types :
    - data file
    - md5 checksum file. It contains the checksum of the data file.

    I want to use an aggregator which will combine these 2 files into a single message.
    In pseucode code it would be :
    //Correlation Method
    public String groupByMd5(Message<File> message) {
    if data file then calculate and return md5 as string
    if md5file checksum file then extract and return md5 as string
    }

    //Release Method
    public boolean canRelease(List<Message<File>> messages) {
    //compare md5 of data file with md5 of checksum file, if ok return true
    }

    First I'd like to know if the aggregator is the most appropriate endpoint for that kind of validation
    Then I wonder how to use the md5 string as correlation id. Message and their headers are immutable so I can't modify it.

    There's a lot of new integration concepts I am not familiar with, so I want to make sure the design is correct befoire going further. If you have a better solution I 'm all heared

    thx for your help

  2. #2
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    Yes aggregator would be perfect for this.
    You're right headers are immutable, but they are only immutable within a single message which only lives till the next endpoint, then the new message is created and so on. So this is when you can add any headers you want. For example there is a Content Enricher pattern and we have Header Enricher implementation that would allow you to set correlationId. Read more here: http://static.springsource.org/sprin...ntent-enricher
    Last edited by oleg.zhurakousky; Jun 6th, 2011 at 07:08 AM.

  3. #3
    Join Date
    Jun 2011
    Posts
    2

    Default

    Perfect, the Header Enricher is exactly what I was missing. thanks !

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •