gopostal
gopostal is a personal exercise to learn golang and minimize job latency and cost while processing jobs. (WORK IN PROGRESS)
The Problem
You have a ruby application that schedules email delivery jobs using sidekiq, the idea is to process this emails using a go-based background worker. Also, you would like to be able to change between different email providers as need it.
Email Providers:
Getting Started
-
Install Goop from outside the proejct: go get github.com/nitrous-io/goop
-
Run goop install
-
Build worker goop go build worker.go
-
Run the worker ./worker -queues=sendemail
Libraries Used
Examples
First, you need the following env variables:
MAILGUN_DOMAIN
MAILGUN_API_KEY
REDIS_NAMESPACE
REDIS_SERVER
REDIS_DB
REDIS_POOL
REDIS_PWD
Schedule the job in Rails:
SendEmail.perform_async("from@email.com", "to@email.com", "SUBJECT", "EMAIL IN TEXT", "https://s3.amazonaws.com/goemail-tests/email.html")
Run the go worker and process the job to test:
goop go run worker.go send_email.go
Run the Playground
Test email delivery:
goop go run playground.go
You need the following env variables:
SANDBOX_MAILGUN_DOMAIN
SANDBOX_MAILGUN_API_KEY
TEST_FROM
TEST_SUBJECT
TEST_PLAIN
TEST_TO
TEST_EMAIL_URL
TODO
- Finish up mail library
- Move send_email to use the mail library
- Add send by batch support (needs to connect to db)
- Write tests
LICENSE
MIT