Remote storage integration implementation options


      1. Initiate the accession from inventory by making a request to remote-storage module
Pros:

  • Not so complicated

Cons:

  • Will affect performance of Inventory
  • Adding partly related business logic to inventory will make the code more complicated


       2.  Inventory will send Kafka messages to the topic with ids of changed items/holdings along with the attributes, which are changed.
Remote-storage module will subscribe to these notifications and check if the location was changed to the remote one. For this checking it will need to go to database (or cache this info for some reasonable time or use some cache eviction policy).
Pros:

  • No remote-storage related business logic in Inventory
  • Event-sourcing from inventory provide decoupling of services and could be beneficial in many future use cases. For instance It could be used for search updates notifications (but worth mentioning, that search won't need the changed attributes info), see: Search


Cons:

  • More complicated than other options
  • Location information caching in policy is not clear


       3. Use database triggers as @Tod Olson suggested in the doc to add the item to the queue, if the location is changed to remote.
Pros:

  • Extremely simple

Cons:

  • Accession by button cannot be implemented in such case
  • Business logic in the database
  • Completely different approach will be for Caisoft


Rejected:

Call the accession method from the UI. was rejected because it cannot provide the same mechanism for changes of location from UI and changes that are applied automatically (e.g. data-import)

Pros:

  • UI have all the necessary data
  • UI still needs to show the popup, so the business logic for getting this info will be still on UI. The last remaining action would be to make one call to remote-storage module.
  • It will be better for performance because in such case server won't need to verify, that the location is remote on every save action and then call another service if it has remote flag.

Cons:

  • Usually such business logic is supposed to be on server side