Add implementation of processing duplicated ID and duplicated file cases.
@tim.schoof Add implementation of processing duplicated ID and duplicated file cases. How asapo should react on message insertion if message_id already exists or/and fine name is already exists.
This MR suggest following logic:
Node: in receiver process handling file saving is done before injection metadata to the MongoDB.
- Message have the file name that already exists:
- Metadata already exists in the DB and is the same: Overwrite the file. Give warning to client.
- Metadata already exists in the DB and no the same: Return and err (duplicated ID)
- Metadata does not exists in the DB: Overwrite the file. Give warning to client.
- Metadata already exists in the DB and is the same: Give warning to client.
- Metadata already exists in the DB and no the same: Return and err (duplicated ID)
Node: Metadata considered the same if:
- Data size is the same
- User meta json string is the same
- filename is the same
Architecture of implementation:
Check of the metadata is done on a broker side. In case of Metadata inject no extra request to the broker is needed. In case of file injection a new broker request check_meta
is created. At the end broker uses the same function to perform the check.
Types of errors (e.g. ConsumerErrorTemplates::kWarningDuplicatedRequest
) to be discussed.