Skip to main content
edited title
Link
Tulains Córdova
  • 39.6k
  • 13
  • 102
  • 157

Shared file storage for several web apiAPI projects

Source Link
Bartosz
  • 597
  • 1
  • 5
  • 12

Shared file storage for several web api projects

I am designing a web application that is supposed to be an 'entry point' for a few file processing tools.

Lets call the main app the 'Connector' and the tools will be 'Tool1', 'Tool2' etc.

The tools will be installed on separate servers and expose a REST API (my design).

The files should be stored somewhere in a shared central location, so that they are not transferred between the services.

The idea is as follows. The user uploads a file to the 'Connector'. I want to take the file evaluate and use a file repository to store it on some network share. The storage is yet to be decided, so I will need a generic FileProvider class that will provide access to the files - regardless whether its an azure blob, FTP server or shared folder on a network.

I will have a database accessed with EF that will hold metadata information about the files (who uploaded it, when, file name, file guid etc). I will then need to send a POST request to Tool1, to process the file. I want to only send the file ID, not the actual path.

The Tool1 is supposed to pick the file from the shared location by ID and process it - then save the processed version of this file on the same shared location - and send a success callback to 'Connector'.

Connector will then evaluate the file and maybe send a similar REST request to the 'Tool2' - again, just with the file ID. Same story, basically.

The problem I am having is... In order for the files to be picked by ID, the 'Tools' WebApi projects would have to have access to the same database. Is that a correct approach?

I wanted the Tool APIs to be pretty much independent and separate from the Connector app, and it seems to be coupling them...