This service is part of the Open Data Mesh (ODM) Platform and handles email notifications for marketplace subscription and unsubscription events. It provides customizable email templates and configurable SMTP settings to notify users about their data product access status.
- Sends email notifications for subscription and unsubscription events
- Customizable email templates using Mustache templating
- Configurable SMTP settings
- Docker support for easy deployment
- Build: Java 11 or later
- Runtime: Java 11 or later
- Docker Image: Uses Amazon Corretto 11 (Alpine-based)
The service is built and tested with:
- Java 11 (Amazon Corretto)
- Java 21 (OpenJDK)
While the service should work with any Java 11+ distribution, we recommend using:
- Amazon Corretto 11
- OpenJDK 11/21
The service can be configured through environment variables:
SPRING_MAIL_HOST=your-smtp-server
SPRING_MAIL_PORT=587
SPRING_MAIL_USERNAME=your-username
SPRING_MAIL_PASSWORD=your-password
ODM_EMAIL_FROM=your-sender-email
The service supports two types of email templates:
- Subscription notification
- Unsubscription notification
Templates can be loaded from:
- Classpath (default)
- External file system (configurable)
Default template paths:
ODM_EMAIL_SUBSCRIBE_TEMPLATE_PATH=classpath:templates/email/subscribe-template.mustache
ODM_EMAIL_UNSUBSCRIBE_TEMPLATE_PATH=classpath:templates/email/unsubscribe-template.mustache
The following variables are available in the templates through the data
object:
Request Details:
{{data.request.name}}
: Name of the request{{data.request.identifier}}
: Unique identifier of the request{{data.operation}}
: Type of operation (MARKETPLACE_SUBSCRIBE or MARKETPLACE_UNSUBSCRIBE){{data.v}}
: Version of the request
Data Product Information:
{{data.request.provider.dataProductFqn}}
: Fully qualified name of the data product{{#data.request.provider.dataProductPortsFqn}}{{.}}{{/data.request.provider.dataProductPortsFqn}}
: List of data product ports
Access Details:
{{data.request.consumer.type}}
: Type of consumer (dataproduct, user, team){{data.request.consumer.identifier}}
: Identifier of the consumer{{data.request.startDate}}
: Start date of the access period{{data.request.endDate}}
: End date of the access period
Requester Information:
{{data.request.requester.type}}
: Type of requester{{data.request.requester.identifier}}
: Identifier of the requester
Additional Properties:
{{#data.request.properties}}{{@key}}: {{.}}{{/data.request.properties}}
: Any additional properties provided in the request
- Create a new
.mustache
file with your template content - Use the available variables in your template
- Configure the template path in your environment:
ODM_EMAIL_SUBSCRIBE_TEMPLATE_PATH=/path/to/your/subscribe-template.mustache ODM_EMAIL_UNSUBSCRIBE_TEMPLATE_PATH=/path/to/your/unsubscribe-template.mustache
- Java 11 or later (see Requirements section for details)
- Maven (optional, project includes Maven wrapper)
# Build the project
./mvnw clean install
# Run tests
./mvnw test
# Build the project
mvn clean install
# Run tests
mvn test
# Build the image
docker build -t odm-marketplace-email-sender .
docker run -d \
-p 8080:8080 \
-e SPRING_MAIL_HOST=your-smtp-server \
-e SPRING_MAIL_USERNAME=your-username \
-e SPRING_MAIL_PASSWORD=your-password \
-e ODM_EMAIL_FROM=your-sender-email \
-v /path/to/your/templates:/etc/odm/templates/email \
odm-marketplace-email-sender
The following environment variables can be configured when running the container:
SPRING_MAIL_HOST
: SMTP server hostSPRING_MAIL_PORT
: SMTP server port (default: 587)SPRING_MAIL_USERNAME
: SMTP usernameSPRING_MAIL_PASSWORD
: SMTP passwordODM_EMAIL_FROM
: Sender email addressODM_EMAIL_SUBSCRIBE_TEMPLATE_PATH
: Path to subscription templateODM_EMAIL_UNSUBSCRIBE_TEMPLATE_PATH
: Path to unsubscription template
To use custom email templates, mount a volume containing your template files:
-v /host/path/to/templates:/etc/odm/templates/email
The service includes default templates that are used when no custom templates are provided. These templates are located in:
src/main/resources/templates/email/subscribe-template.mustache
src/main/resources/templates/email/unsubscribe-template.mustache
These templates include a disclaimer indicating they are default templates and should be replaced with custom ones in production.
Please read our contributing guidelines before submitting pull requests.
This project is licensed under the terms of the license included in the repository.