This is an application designed for adding capabilities to integrate with different email providers. Basic DDD and SOLID principles are applied in the design so that email providers can be easily added and removed.
- Spring boot 2.7.15
- H2 as InMemory DB.
- Java 11
- Maven
- Lombok Support
- Annotation Processor
property | sample value | description |
---|---|---|
server.port |
8080 | server http port |
spring.datasource.url |
jdbc:h2:mem:emaildb | db url |
spring.datasource.username |
sa | db user name |
spring.datasource.password |
db password |
- mvn clean install
./mvnw spring-boot:run
ormvn spring-boot:run
orjava -jar target/application-0.0.1-SNAPSHOT.jar
- Data can be viewed/queried through h2 console http://localhost:8080/h2-console/
api/v1/email/generate/{type} - GET
api/v1/report/generate - POST
The documentation for all sever endpoints can be found in /src/main/resources/POSTMAN_COLLECTION.json
file.
- Import the json collection file in Postman client.
- Invoke Generate Email API for generating email based on supplied type.
- Invoke Generate Report API for loading mock json and persist to db asynchronously.
http://localhost:8080/swagger-ui/
- SENDGRID
- SPARK
- MAILGUN
- DEFAULT
- Based on the provider type, a template will be built and an email will be generated.
- Currently, integration is implemented with SendGrid provider.
- Remaining providers act as a mock email provider but the generated email is distinguished based on the type.
- A fallback mechanism is implemented if supplied provider is not found or not up and running.
- Fallback will be based on Priority value, the highest up and running provider will be picked to generate an email.
- Priority will be swapped from failing provider to the new provider based on priority comparison.
- Report Generator to generate and persist mock data asynchronously.