Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wermajew/fileanalyzer
Java microservice that process large XML and returns file details summary
https://github.com/wermajew/fileanalyzer
interview-exercise interview-test java rest-api spring-boot xml xml-parsing
Last synced: 3 months ago
JSON representation
Java microservice that process large XML and returns file details summary
- Host: GitHub
- URL: https://github.com/wermajew/fileanalyzer
- Owner: wermajew
- Created: 2020-03-05T16:53:17.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-11-16T01:19:28.000Z (about 2 years ago)
- Last Synced: 2024-07-30T21:06:02.099Z (5 months ago)
- Topics: interview-exercise, interview-test, java, rest-api, spring-boot, xml, xml-parsing
- Language: Java
- Homepage:
- Size: 116 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Goal:
Create an API server which can analyse the content of big xml files
A distributable docker container running the server (Bonus)## Requirement:
- Create an API with Spring Boot (Java) and Maven.
- A POST request should be possible with a url to an XML file (this file can be > 1GB)
- The response of the post request should hold an overview of the analysation of the XML (see example below, feel free to add more fields).
- The code should be unit and component tested.
- The code should pass the maven build and be runnable via cli with max of 512MB of memory.
At least a single Java 8 feature should be included.### Request
``curl -i -X POST \
-H "Content-Type:application/json" \
-d \
'{
"url": "{{url}}"
}' \
'http://localhost:8080/analyze/'``
#### Response:
``{
"analyseDate":"2016-04-25T14:52:30+00:00",
"details" {
"firstPost":"2016-01-12T18:45:19.963+00:00",
"lastPost":"2016-03-04T13:30:22.410+00:00",
"totalPosts":80,
"totalAcceptedPosts":7,
"avgScore":13
}
}``
## Run application
Latest image will be pulled from Docker Hub.
Just copy docker-compose.yml and run ``docker-compose up -d``## Ideas for improvements
- Service has been impemented accordingly to specified contract so solution is synchronous but to prevent requests that take up to several minutes, asynchronous implementation could be used
- Storing information about processed file to prevent calculating same file (based on some assumtions like: file size, given file from particular uri and size has been processed, returned persisted data about file details)