OpenAS2 / OpenAs2App

OpenAS2 is a java-based implementation of the EDIINT AS2 standard. It is intended to be used as a server. It is extremely configurable and supports a wide variety of signing and encryption algorithms.
https://sourceforge.net/projects/openas2/
BSD 2-Clause "Simplified" License
182 stars 136 forks source link

Write file after successfully sending MDN #260

Closed SijmenHuizenga closed 4 months ago

SijmenHuizenga commented 2 years ago

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:

  1. We received an as2 message, which was written to disk.
  2. An MDN was generated and sent, but the network connection was unstable and the MDN failed (many SocketException: Broken pipe).
  3. In the meantime, our systems detected the new received file in on disk and processed it.
  4. 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?

uhurusurfa commented 2 years ago

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.

uhurusurfa commented 2 years ago

Try the latest release 3.2.0 for a fix.