Yeah, I know. Thats a mouth full, perils of webscale, I guess.

I was recently having a conversation with Taylor Otwell on twitter about consuming Laravel queue messages in other languages, and figured Id quickly throw together a little proof of concept.

You can see all of the source code here.

There is an almost fresh laravel install, with a single artisan command email:send. The command simply uses Queue:push to put a message in a beanstalkd queue. The app does nothing else, but one could image its a fully functional app undergoing a refactor.

There is also a small go application here. This worker listens to the beanstalk queue with one goroutine, and sends email with another. The goroutines communicate through a single channel. Ive included the complied go binary in case someone wants to play with this without getting a go environment setup.

The source for the go application is relativly small, and should be pretty readable. Feel free to ask questions in the comments if something isnt entirely clear.

If you want to play with this, youll need a valid sendgrid account and Beanstalkd running and the following env vars set:

  • BEANSTALKD: location of the beanstalk installation (e.g. localhost:11300)
  • SENDGRID_USER: username for sendgrid account
  • SENDGRID_PASS: password for sendgrid account

Update: Extra special thanks to the SendGrid team for provisioning a test account early on a saturday morning.