This platform is based on Event-driven microservice architecture. So far, it has got two services; namely sms gateway service and spam filter service.
The sms gateway service has two modules - customer module and sms module. The customer module primary deals with registering customers. The sms gateway service will be decomposed into two services (customer service and sms gateway service) in the future. The sms module exposes endpoints so customers can send sms. And it publishes the sms into two rabbitmq queues with topic exchange. The first queue, named charging-module-queue, is which the charging module service consumes from. And, the second queue, named spam-filter-queue, is which the spam filter service consumers from. The reason we have two queues is the data that goes into the charging module service can be different from the data that goes to the spam filter and finally to the sms delivery server in the telecom infrastructure in the future.
The spam filter service consumes messages from rabbitmq queue. then filters out sms messages with destination address that don't start with +251 or 00251. Finally, the message is sent to the delivery server. To do so, spam filter makes use of Spring Integration Java DSL. Message is consumed from rabbitmq inbound channel adapter, then transformed, filtered and using service activator sent to delivery server.
Since the whole platform is designed based on reactive approach, it is highly scalable. Moreover, it is designed to handle 100,000 requests per second.
- Registering Customers
- Receiving sms from customers and publish it to charging-module-queue and spam-filter-queue
- Proper Error Handling
- Integration and Unit Test For Persistence, Service, and Presentation layers
- Logging to console
- Security
- Auditing
- Logging to file
- Dockerizing the service
- Swagger documentation
- Consuming sms messages from rabbitmq queue
- Filtering out spams(Note: spams are destination address that don't start with +251 or 00251)
- Send to delivery server using service activator
- Logging to console
- Proper Error Handling
- Integration and Unit Test For Persistence, Service, and Presentation layers
- Logging to file
- Security
- Auditing
- Dockerizing the service
- Java >= 11 (OpenJDK JVM is tested)
- Spring Framework 5
- Spring Boot 2.5.9
- Spring Webflux
- Spring Data MongoDB Reactive
- Spring AMQP
- Spring Integration
- Logback
- Spring test
- JUnit 5
- Java >= 11 (OpenJDK JVM is tested)
- MongoDB 5.0
- RabbitMQ 3.9
- Erlang 24.1
- Apache Maven 3.8
Run the following commands inside the services root directory:
./mvnw spring-boot:run
- Clone the repository or download and extract the archive file to your local directory.
- Run
./mvnw clean install
to build a modern cloud native fully self contained JAR file which will be created attarget
directory within each service root directory. - Run
java -jar target/sms-gateway-0.0.1-SNAPSHOT.jar
from sms-gateway root directory to run the sms gateway service - Run
java -jar target/spam-filter-0.0.1-SNAPSHOT.jar
from spam-filter root directory to run the spam filter service
Note that the tests will make use of embedded mongodb.
Run the following command from the root directory of sms-gateway:
./mvnw test
Creating Customer:
curl --location --request POST 'http://localhost:8080/customers' --header 'Content-Type: application/json' --data-raw '{ "firstName":"John", "lastName":"Mohamed", "phoneNumber":"+251944658408", "email":"john@email.com" }'
Sending SMS:
curl --location --request POST 'http://localhost:8080/sms/send' --header 'Content-Type: application/json' --data-raw '{ "senderPhone":"+251944658408", "receiverPhone":"+251944658445", "text":"Hi" }'
NOTE: Security is not implemented yet. The platform will have identity provider service, authentication and authorization service. The services that connect to rabbitmq will need ssl certificates. JWT will be used for authentication.
The service should be started with the following JVM options:
-Ddb.url=localhost
-Ddb.port=27017
-Ddb.name=smsdb
The service should be started with the following JVM options:
-Dmq.host=localhost
-Dmq.port=5672
-Dmq.username=guest
-Dmq.password=guest