The notifications microservice is an independently deployable component intended for sending various types of notifications. It provides a common abstraction layer on top of the various notification types and actual sending, tracking routines.
Notifier supports the most common notification types and platforms. The project aims to enable the user to only rely on notifier for client messaging/communication. Below are the supported notification types and implementations.
The microservice supports sending regular emails. The supported transports are:
- SMTP
- MailChimp / Mandril
The microservice supports sending SMS notifications. The supported transports are:
Push notifications to mobile devices are supported. As of now, only one provider is available:
You can call the notifier's REST API directly or use the provided Java client library. To use the client library add the following maven dependency:
<dependency> <groupId>com.sflpro.notifier</groupId> <artifactId>api-client-library</artifactId> <version>1.10.1</version> </dependency>The API is documented using OpenAPI Specification(Swagger) and the documentation JSON is available under /swagger.json once the notifier microservice has been started.
Notifier is dockerized and is easy to deploy as a docker container. For more details, see the images on docker hub:
https://hub.docker.com/r/sflpro/notifier-api & https://hub.docker.com/r/sflpro/notifier-worker
The postgres has official images in docker hub.
docker run --name notifier-postgres -e POSTGRES_PASSWORD=notifier -e POSTGRES_USER=notifier -e POSTGRES_DB=notifier -p 5432:5432 -d postgres:11RabbitMQ has official images in docker hub. Running RabbitMQ with management plugin enabled
docker run -d --hostname notifier-rabbit --name some-rabbit -p 5671:5671 -p 5672:5672 -p 15672:15672 rabbitmq:3-management# Postgres spring.datasource.url=jdbc:postgresql://{HOST_IP}:5432/POSTGRES_DB spring.datasource.username=POSTGRES_USER spring.datasource.password=POSTGRES_PASSWORD # Notifier queue engine notifier.queue.engine=rabbit # RabbitMQ spring.rabbitmq.host={HOST_IP} spring.rabbitmq.username=guest # Container port server.port=8080Running Notifier-API docker images.
docker run -p 8080:8080 -v {NOTIFIER_-_PROPERTIES_PATH}:/etc/notifier/notifier.properties sflpro/notifier-api:1.7.0 --spring.config.additional-location=etc/notifier/notifier.propertiesRunning Notifier-Worker docker images
docker run -p 8081:8080 -v {NOTIFIER_-_PROPERTIES_PATH}:/etc/notifier/notifier.properties sflpro/notifier-worker:1.7.0 --spring.config.additional-location=etc/notifier/notifier.propertiescurl -X POST "localhost:8080/notification/email/create" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"recipientEmail\":\"recipient-email@example.com\",\"senderEmail\":\"sender-email@example.com\",\"subject\":\"testing-subject\",\"templateName\":\"Email template name\"}" To externalized application properties add the following command as a program argument
--spring.config.additional-location=/your/location/properties-file.propertiesConfigure kafka to use SASL_SSL security protocol
kafka.ssl.endpoint.identification.algorithm=https kafka.sasl.mechanism=PLAIN kafka.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="<API_KEY>" password="<API_SECRET>"; kafka.security.protocol=SASL_SSL