Manipulate Files Asynchronously (MaFiA): Asynchronous file manipulation service, designed for microservice architectured projects, is now avaliable on GitHub here!
Most of the big web peojects requires file manipulation. Some images needed to be scaled, some documents needed to be converted from docx to pdf, pdf to image, excel (xlsx) to pdf reports, or between any format. Some part of a file needed to be extracted somewhere else, etc... While implementing these tasks, you, developers, need to implement some kind of management codes too. You need to keep track of which files are processed, which ones are waiting. You need to be sure that all files are processed. You need asynchronous processing in order to gain time and non-blocking computing.
At this point, MaFiA is here to execute! Developers will only develop manipulation logic they need and apart from that, every management requirement will be ready on this tiny microservice: MaFiA.
Here is the ready features in this Spring Boot application code base:
- Provide simple RESTFul API.
- Create file manipulation job by uploading a file with manipulation parameters and get a UUID for the process. For example, upload a big resolution image.
- Determine which manipulation is needed to apply to the uploaded file in parameters. i.e. say "scale_image".
- Give job specific parameters. i.e. give scale factor as 0.3.
- Query the job status using generated UUID.
- Download output file using generated UUID.
- At configuration file (application.properties) define whatever executor pool size you want. You can increase the executor thread pool size in order to increase number of files to manipulate simultaneously.
- Define your own manipulation logic and integrate easily into application.
Test Demos on Youtube here:
How Can I Define and Integrate My Own File Manipulation Logic?
You only need to
- Create a manipulation class that extends AbstractManipulation
- Implement the applyManipulation() method
- Register this new class to ManipulationStoreService in the InitManipulationStoreService class
Here is the InitManipulationStoreService
How Can I Test It?
Here is an example MaFiA usage for a single image file. In this example, we use Apache HttpClient to consume MaFiA REST API, send HTTP requests and receive responses.
Which Technologies Are Used in MaFiA?
MaFiA is a Spring Boot application. For database, it uses PostgreSql. There is no security implementation here because every project has its own different security approach. One developer can easily integrate security logic into MaFiA. It is open source and freely available on GitHub here.
Similarly if you want, database technology or file storage method can be cutomized easily for your own project technology stack.
For 100 files manipulation and 1000 files multi threaded file manipulation client examples watch this demo on Youtube:
1 Yorumlar
Object store ozelligi de olursa iyi olur.
YanıtlaSil