An addEmailServer is running, serving many async clients sending users' email id. This server adds these email ids to RabbitMQ. Another server (sendEmailServer) is running, which is serving clients asynchronously. It uses the sender email id and email body from the client requests; it consumes the receiver email id from RabbitMQ and sends an email using send grid API. The project uses gRPC in golang.
brew install rabbitmq
export PATH=$PATH:/usr/local/sbin
rabbitmq-server start
Run go mod download
from project root
From project root run cd emailService
Run go run addEmailServer/server.go
Run go run addEmailClient/client.go
Create an account with sendgrid and generate your API key reger
Create an environment variable with your API Key and registered email id
echo "export SENDGRID_API_KEY='YOUR-API-KEY'" > sendgrid.env
echo "export SENDER_EMAIL_ID='YOUR-REGISTRED-EMAIL-ID" > sendgrid.env
echo "sendgrid.env" >> .gitignore
source ./sendgrid.env
Run source ./sendgrid.env && go run sendgridServer/sendgridServer.go
Run source ./sendgrid.env && go run sendEmailClient/sendgridClient.go
├── LICENSE
├── Readme.md
├── emailService
│ ├── addEmailClient
│ │ └── client.go
│ ├── addEmailServer
│ │ └── server.go
│ ├── proto
│ │ ├── email.pb.go
│ │ ├── email.proto
│ │ └── email_grpc.pb.go
│ ├── sendEmailClient
│ │ └── sendgridClient.go
│ ├── sendEmailServer
│ │ └── sendgridServer.go
│ └── sendgrid.env
├── go.mod
└── go.sum