Deposit handoff in REST API

Deposit handoff in REST API


When the REST API handles a application/vnd.crossref.deposit+xml deposit created via a POST to /deposits the following process is carried out:

graph LR; createDeposit(1. create-deposit!); beginHandoff(2. begin-handoff!); performXmlDeposit(3. perform-xml-deposit-handoff); depositFail(4. failed!); depositSuccess(4. end-handoff!); depositUpdateMessageHandler(5. Deposit Update Message Handler); createDeposit-->beginHandoff; beginHandoff-->performXmlDeposit; performXmlDeposit-- Deposit Failed -->depositFail; performXmlDeposit-- Deposit Succeeded -->depositSuccess; depositSuccess-->depositUpdateMessageHandler click depositUpdateMessageHandler "../../deposit-update-message-handler" "Deposit Update Message Handler";

  1. create-deposit! - Creates a new deposit in MongoDB with a handoff.status of incomplete
  2. begin-handoff! - Begins the handoff to, this doesn’t impact handoff.status but is used to track failure and retry count
  3. perform-xml-deposit-handoff - Carries out the deposit using

If the deposit to has failed:

  1. failed!- Marks the handoff as complete and updates status to failed, note status not handoff.status. status indicates the deposit actually failed, not that there was an issue with the handover that can be retried

If the deposit to is successful:

  1. end-handoff!- Marks the handoff as complete and updates handoff.status to completed
  2. monitors the mailbox associated with deposits made via the REST API, if there are any errors reported then it updates the deposit status to failed, otherwise to completed