This project uses the following Gradle plugins:
-
Java Plugin: Provides support to compile and test Java source. More Info
-
Spring Boot (
3.1.2
): Helps in creating standalone, production-grade Spring-based applications. More Info -
Spring Dependency Management (
1.1.2
): Offers Maven-like dependency management. It centralizes dependency versions in a multi-module project. More Info
- Asciidoctor (
3.3.2
): Converts AsciiDoc content into HTML, PDF, and other formats. More Info
- Google Jib (
3.3.1
): Builds optimized Docker and OCI images for Java applications without requiring a Docker daemon. More Info - By running
./gradlew jib
the image will be built and pushed to the docker hub repository, by running./gradlew jibDockerBuild
the image will be built and stored locally.
-
Lombok (
8.1.0
): Reduces boilerplate in Java code like getters, setters, equals, etc. using annotations. More Info -
Checkstyle: Ensures Java code adheres to a coding standard. More Info
-
PMD: Source code analyzer that detects common programming flaws. More Info
-
SpotBugs (
4.7.0
): Uses static analysis to identify bugs in Java code. More Info
- JaCoCo: A Java Code Coverage tool. More Info
- Clone the repository.
- Navigate to the project directory.
- Run the project using:
./gradlew bootRun
The application has several configuration options that are defined in the application.yml
file. Here's a breakdown:
- header-columns: Defines the columns to be used as headers in the file.
- Default:
timestamp,symbol,price
- Default:
- sourceDir: The directory where files are located.
- Default:
src/main/resources/templates/
- Default:
- name-pattern: Pattern to match file names.
- Default:
*_values.csv
- Default:
- chunks: Number of rows to process in a batch.
- Default:
10000
- Default:
Symbols that are not allowed for processing:
ETH, SOL, SHIB
- port: Port on which the application runs.
- Default:
8080
- Default:
Configuration details for the database:
- URL:
jdbc:h2:mem:crypto_db;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
- Driver:
org.h2.Driver
- Username:
sa
- Console access for H2 database is enabled.
JPA configurations and properties:
- Hibernate properties are set, with
show-sql
enabled to display SQL statements. ddl-auto
is set toupdate
.
Spring Batch configurations, including:
- Job initializer status.
- JDBC schema initialization settings.
- The Swagger UI path for API documentation:
/swagger-ui.html
. - By running a service and accessing the URL you can see the API documentation.
Configurations for the rate limiting on REST endpoints:
- restEndpointRateLimiter:
limitForPeriod
: 5 (number of requests per cycle)limitRefreshPeriod
: 1s (duration of a cycle)timeoutDuration
: 0 (maximum waiting time for a permit)
- How long we want ot keep data in the database and provide sufficient performance.
- Possible solution: We can use a cron job to delete the data older than 1 year or archive them to another table which will not be used for database queries.
- After some amount of time we can aggregate statistic together and store them in a separate table in a single record which will lighten query and computation effort.
- After some time some endpoints might return high volume of record which is not desirable.
- Possible solution: We can use pagination to limit the number of records returned by the endpoint.
- After CSV batch load we should consider a mechanism how to archive these file for possible further investigation or analysis.
- Possible solution: We can use a cron job to archive the files after a certain amount of time.
- We should consider some caching mechanism to improve performance.
- Possible solution: We can use Redis to cache the data.