790f8a6abf
* Minor changes on mqtt publisher using nats Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove vernemq dependencies Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Restore VerneMQ config files Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Fix Makefile to support custom Docker profiles The Makefile has been updated to support custom Docker profiles. Previously, the Makefile only supported the default profiles for the message broker and MQTT broker. Now, the Makefile allows for custom profiles to be specified using environment variables. If the MF_BROKER_TYPE or MF_MQTT_BROKER_TYPE variables are not set, the default values "nats" and "nats" will be used, respectively. This change enables more flexibility in configuring the Docker environment for the project. The `run` target has also been modified to use the correct broker configuration file based on the MF_BROKER_TYPE variable. The sed command in the `run` target now replaces the placeholder in the docker/docker-compose.yml file with the appropriate broker configuration file. This commit improves the Makefile to support custom Docker profiles and ensures the correct broker configuration file is used when running the project. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Fix queue binding issue in RabbitMQ pubsub The commit fixes an issue in the RabbitMQ pubsub implementation where the queue binding was not correctly set up. Instead of using the topic as the queue name, the commit now uses a unique client ID generated by combining the topic and subscriber ID. This ensures that each subscriber has its own dedicated queue. The commit also updates the queue binding to use the correct queue name. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Refactor Docker config editing in Makefile The commit refactors the `edit_docker_config` function in the Makefile to improve readability and maintainability. The changes include: - Removing unnecessary conditionals related to the `rabbitmq` broker These changes ensure that the Docker configuration is correctly updated based on the specified MQTT broker type. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Fix failing tests on RabbitMQ Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Refactor MQTT_BROKER comment in docker-compose.yml The MQTT_BROKER comment in the docker-compose.yml file has been updated to provide a more accurate description of its functionality. The comment now states that the MQTT_BROKER handles MQTT communication between MQTT adapters and the message broker, instead of Mainflux services. This change improves clarity and aligns with the actual purpose of the MQTT_BROKER. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Rename `MF_BROKER` to `MF_MESSAGE_BROKER` The Makefile and Semaphore configuration files have been refactored to update the variable names related to the message broker type. These changes ensure consistency and clarity in the codebase by using more descriptive variable names related to the message broker type. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Fix Docker profile configuration for nats_rabbitmq Update the Docker profile configuration for nats_rabbitmq by replacing the NATS URL in the .env file with the correct value. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Rename MF_BROKER_URL to MF_MESSAGE_BROKER_URL Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Fix MQTT QoS level in pubsub.go The MQTT QoS level in the pubsub.go file was set to 1, which is the default level. However, since NATS supports up to QoS 1, I updated the QoS level comment to reflect this. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Refactor NewPublisher to accept QoS parameter The NewPublisher function in the pkg/messaging/mqtt/publisher.go file has been refactored to accept a new parameter, qos, which represents the Quality of Service level for MQTT message publishing. This change allows for more flexibility in configuring the MQTT publisher. The NewPublisher function now has the following signature: ```go func NewPublisher(address string, qos uint8, timeout time.Duration) (messaging.Publisher, error) ``` This change ensures that the MQTT publisher can be created with the desired QoS level, enhancing the reliability and delivery guarantees of the published messages. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Fix test assertions in pubsub_test.go The test assertions in the pubsub_test.go file were incorrect. This commit fixes the assertions to properly compare the expected and received message values. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Test configurable MQTT broker Signed-off-by: rodneyosodo <blackd0t@protonmail.com> --------- Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> |
||
---|---|---|
.. | ||
README.md | ||
doc.go | ||
notifier.go |
README.md
SMTP Notifier
SMTP Notifier implements notifier for send SMTP notifications.
Configuration
The Subscription service using SMTP Notifier is configured using the environment variables presented in the following table. Note that any unset variables will be replaced with their default values.
Variable | Description | Default |
---|---|---|
MF_SMTP_NOTIFIER_LOG_LEVEL | Log level for SMT Notifier (debug, info, warn, error) | info |
MF_SMTP_NOTIFIER_FROM_ADDRESS | From address for SMTP notifications | |
MF_SMTP_NOTIFIER_CONFIG_PATH | Path to the config file with message broker subjects configuration | disable |
MF_SMTP_NOTIFIER_HTTP_HOST | SMTP Notifier service HTTP host | localhost |
MF_SMTP_NOTIFIER_HTTP_PORT | SMTP Notifier service HTTP port | 9015 |
MF_SMTP_NOTIFIER_HTTP_SERVER_CERT | SMTP Notifier service HTTP server certificate path | "" |
MF_SMTP_NOTIFIER_HTTP_SERVER_KEY | SMTP Notifier service HTTP server key | "" |
MF_SMTP_NOTIFIER_DB_HOST | Database host address | localhost |
MF_SMTP_NOTIFIER_DB_PORT | Database host port | 5432 |
MF_SMTP_NOTIFIER_DB_USER | Database user | mainflux |
MF_SMTP_NOTIFIER_DB_PASS | Database password | mainflux |
MF_SMTP_NOTIFIER_DB_NAME | Name of the database used by the service | subscriptions |
MF_SMTP_NOTIFIER_DB_SSL_MODE | Database connection SSL mode (disable, require, verify-ca, verify-full) | disable |
MF_SMTP_NOTIFIER_DB_SSL_CERT | Path to the PEM encoded cert file | "" |
MF_SMTP_NOTIFIER_DB_SSL_KEY | Path to the PEM encoded certificate key | "" |
MF_SMTP_NOTIFIER_DB_SSL_ROOT_CERT | Path to the PEM encoded root certificate file | "" |
MF_JAEGER_URL | Jaeger server URL | http://jaeger:14268/api/traces |
MF_MESSAGE_BROKER_URL | Message broker URL | nats://127.0.0.1:4222 |
MF_EMAIL_HOST | Mail server host | localhost |
MF_EMAIL_PORT | Mail server port | 25 |
MF_EMAIL_USERNAME | Mail server username | |
MF_EMAIL_PASSWORD | Mail server password | |
MF_EMAIL_FROM_ADDRESS | Email "from" address | |
MF_EMAIL_FROM_NAME | Email "from" name | |
MF_EMAIL_TEMPLATE | Email template for sending notification emails | email.tmpl |
MF_AUTH_GRPC_URL | Users service gRPC URL | localhost:7001 |
MF_AUTH_GRPC_TIMEOUT | Users service gRPC request timeout in seconds | 1s |
MF_AUTH_GRPC_CLIENT_TLS | Users service gRPC TLS flag | false |
MF_AUTH_GRPC_CA_CERT | Path to Users service CA cert in pem format | "" |
MF_AUTH_CLIENT_TLS | Auth client TLS flag | false |
MF_AUTH_CA_CERTS | Path to Auth client CA certs in pem format | "" |
MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true |
MF_SMTP_NOTIFIER_INSTANCE_ID | SMTP Notifier instance ID | "" |
Usage
Starting service will start consuming messages and sending emails when a message is received.