Author - Ravi Parekh
For further reference, please consider the following sections:
- Testcontainers Postgres In Memory Testing container Module Reference Guide
- Testcontainers
- Swagger API Documentation
- Internationalization i18n
- Exception Handling
- OAuth2 Security resource server
- Github Pipeline with GCP Run - warehouse.yml
Microservice related to this application should be resided in this GitHub monorepo, the only problem with this monorepo is 'per-project access control'
- Some component and utility can be moved to Common Component which can be used as dependency, which has not been done yet e.g. GlobalExceptionHandler.java, *Enum.java to Common
- Database per MS
Used spring method cache and etag for performance and reduce further hits to DBDue to lack of time- Used materialized view in postgres to store/update the stocks sold and brought in once so need to hit the DB each time to available stocks until product sold out Postgres materialized view
To Convert Json Schema to model plugin can be used
- jsonschema2pojo
- org.openapitools
- Internationalization i18n is done, see resources/messages for ERROR handling
- In the Future, message translation can be taken to Phrase and Config Server so deployment in zero downtime
- Automated Sync between Phrase app and git should be done via script(hook)
- Integration testing with in memory real time POSTGRES Db (test container)
mvn clean verify
- R2DBC - reactive non-blocking programming APIs to relational databases
- Only drawback of this is t does NOT offer caching, lazy loading, write-behind, or many other features of ORM frameworks
- Spring WebFlux - reactive WebClient non-blocking API powered by projectreactor.io
- It is non-blocking reactive client for calling remote http API over underlying HTTP client libraries such as Reactor Netty. It is also replacement of Rest-template
- Security Oauth2 - code need to be uncomment to start user Authentication with OAuth2
- DB migration Use flyway for DB migration and DB versioning
- Application Swagger - Initial request will take time due to Cold start in Google Run. If you see any error in swagger html page, try deleting cookies for that url, and it will work
- curl --location --request POST 'https://warehouse-kb3lmrg37a-lz.a.run.app/products/upload'
--form 'file=@"/Users/raviparekh/Documents/warehouse/src/main/resources/schema/products.json"'