How/where can I compute md5 digest for a file I need to transfer to a samba location in spring-integration in order to validate it against the digest I receive at the beginning of the flow. I get the file from a rest service and I have to make sure file is safely landing to samba location. The middle flow looks like this: (the digest to be compared against is stored somewhere in the messages)
GenericHandler smbUploader;
HttpRequestExecutingMessageHandler httpDownloader;
from(inbound())   //here I receive a notification with url where to download file + a checksum to be validated against
...
.handle(httpDownloader)     //here I get file effectively
.handle(smbUploader)  //here I upload the file to samba
...
and httpDownloader is defined like this:
public HttpRequestExecutingMessageHandler httpDownloader(){
  HttpRequestExecutingMessageHandler  h = new HttpRequestExecutingMessageHandler ("payload.url");
  h.setExpectedResponseType(String.class); 
  h.setHttpMethod(GET); 
  return h; 
}
and smbUploader is defined like this:
public GenericHandler smbUploader (MessageHandler smbMessageHandler){
  return new GenericHandler<Message>(){
  @Override
  public Message handle(Message m, MessageHeaders h){
    smbMessageHandler.handleMessage(m);
    return m;
  }
}
and smbMessageHandler is defined like this:
public MessageHandler smbMessageHandler (SmbRemoteFileTemplate template, FileNameGenerator g){
  SmbMessageHandler h = new smbMessageHandler (template, REPLACE);
  h.setAutoCreateDirectory(true);    
  h.setRemoteDirectoryExpression(getExpression("headers['msg'].smbFolder"));
  h.setFileNameGenerator(g);
  return h;
}
the inbound (starting the flow) is defined like this:
public HttpRequestHandlerEndpointSpec inbound(){
  return Http.inboundChannelAdapter ("/notification")
    .requestMapping(m->m.methods(POST))
    .requestPayloadType(String.class)
    .validator(notificationValidator);
}
 
    