Write file after successfully sending MDN
SijmenHuizenga opened this issue · 2 comments
Thank you for building and maintaining this tool! We have been using openas2 in production for many years and it works great.
Today we ran into the following problem:
- We received an as2 message, which was written to disk.
- An MDN was generated and sent, but the network connection was unstable and the MDN failed (many SocketException: Broken pipe).
- In the meantime, our systems detected the new received file in on disk and processed it.
- After some time the sending party detected the lack of the MDN and re-sent the message, causing the message to be processed once again.
Is there a way to delay writing incoming messages to disk until the MDN has been successfully sent out?
It will require a logic change in the code. The AS2 spec does not define that the MDN has to be sent successfully in order to deliver the file and can get complicated because per the AS2 spec, the MDN is not required.
Currently it does not care whether the MDN is successfully sent or not.
As a rule, the system that consumes files should be idempotent to the file it is processing to avoid the situation you are facing.
I will look into modifying the code to support that mode where it ill not mske the file available until the MDN is successfully delivered.
Try the latest release 3.2.0 for a fix.