Reads emails from mailboxes on a exchange web server. Processes these emails and provides them for clients to retrive.
- Java 21 or higher
- Maven
- MariaDB
- Git
- Dependent services
-
Clone the repository:
git clone [email protected]:Sundsvallskommun/api-service-email-reader.git cd api-service-email-reader
-
Configure the application:
Before running the application, you need to set up configuration settings. See Configuration
Note: Ensure all required configurations are set; otherwise, the application may fail to start.
-
Ensure dependent services are running:
If this microservice depends on other services, make sure they are up and accessible. See Dependencies for more details.
-
Build and run the application:
mvn spring-boot:run
This microservice depends on the following services:
- Exchange Web service
- Purpose: The server the application reads emails from.
- External resource: EWS applications and the Exchange architecture
- Setup Instructions: Refer to its documentation for installation and configuration steps.
- Messaging
- Purpose: Umbrella service to send different types of messages. Used to send SMS-messages for emails configued with the action SEND_SMS. Also used to send email reports if emails get stuck in the database.
- Repository: Link to the repository
- Setup Instructions: Refer to its documentation for installation and configuration steps.
Ensure that these services are running and properly configured before starting this microservice.
Access the API documentation via Swagger UI:
- Swagger UI: http://localhost:8080/api-docs
Alternatively, refer to the openapi.yml
file located in src/integration-test/resources
for the OpenAPI
specification.
Refer to the API Documentation for detailed information on available endpoints.
curl -X GET http://localhost:8080/api/resource
Configuration is crucial for the application to run successfully. Ensure all necessary settings are configured in
application.yml
.
-
Server Port:
server: port: 8080
-
Database Settings:
spring: datasource: url: jdbc:mysql://localhost:3306/your_database username: your_db_username password: your_db_password
-
External Service URLs:
integration: messaging: base-url: http://dependency_service_url token-uri: http://dependecy_service_token_url recipient-adress: [email protected] # Used to send reports if emails are stuck client-id: your-client-id client-secret: your-client-secrect properties: credentials: secret-key: your-super-secret-key # Used to encrypt passwords
The project is set up with Flyway for database migrations. Flyway is disabled by default so you will have to enable it to automatically populate the database schema upon application startup.
spring:
flyway:
enabled: true
- No additional setup is required for database initialization, as long as the database connection settings are correctly configured.
-
Credentials configuration
Use the API to set up the configuration for which email-addresses to monitor
-
Application Profiles:
Use Spring profiles (
dev
,prod
, etc.) to manage different configurations for different environments. -
Logging Configuration:
Adjust logging levels if necessary.
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
This project is licensed under the MIT License.
© 2023 Sundsvalls kommun