$4.99
Description
This package contains [Source Code] of a Email Sender Micro Service Web Application that has an administrative interface and is open for new emails as a Kafka Consumer.
Email Sender Web App
There are two ways this app could be packaged
- as a jar and executed in docker
- or as war and deployed in java servlet/web container.
The difference in the source code is in:
-
The Application.java: - public class Application implements AppShellConfigurator { //for jar
- public class Application extends SpringBootServletInitializer { // for war
- in the pom.xml –
<packaging>war</packaging> - for web app and
<packaging>jar</packaging> for - micro service jar.
Package the Email Sender Micro Service as Jar – Docker Image
This is the default mode of execution.
- using Maria DB as Database
- auto-generate db scheme
- simple CRUD interface over the send mails
- work in progress unit tests
- docker file & setup. If you would like to run it outside docker – just change the configuration from host.docker.internal to localhost
Prerequisite so the Email Sender Micro Servic could function
- Setup your SMPT settings in MailSenderApplication
JavaMailSenderImpl mailSender = new JavaMailSenderImpl(); mailSender.setHost("mail.atyourplace.com"); mailSender.setUsername("sendingaccount@atyourplace.com"); mailSender.setPassword("password")
- Create a DB scheme “mail” in MariaDB and update the credentials
- Start the micro-service – preferebly in Docker container
Sending emails
This application consumes Kafka Messages Asynchroniously. Update the server where kafka is located in the application.properties:
kafka.address=localhost:9092
Besides that:
- the topics are “site_monitor_mail_messages”,
- and the groupId is “mail_messages”
The Body of the Kafka Message is a String with encoded JSON Object with fields
- fromMail;
- toMail;
- subjectOfTheMail;
- textOfTheMail;
Web Admin Interface
The Micro Service has Web Admin Interace http://localhost:8701/emails_manager_app (or emails_manager_app-1.0-SNAPSHOT if the generated war is deployed).
There is hard-coded login as – it is intended to be hidden in your local network, but you could easily extend it and add your authentication.
There is a basic pagination view with the list of send mail messages.
And a basic add/edit/view screen. You will most likely be used for display only in real use case.
Product Packaging
You will receive emails_manager_app source code. You could build it with
mvn clean package -Pproduction -Dvaadin.force.production.build=true
and package it to image with the Dockerfile + the command –
docker build --build-arg JAR_FILE=target/*.jar -t com.programtom.emails_manager_app/Application. The command are included as scripts.