Announcement Announcement Module
No announcement yet.
How would you design md5 file validation with spring integration ? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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:
    Last edited by oleg.zhurakousky; Jun 6th, 2011, 07:08 AM.


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