Skip to content

An asynchronous messaging example for third-party service integration

License

Notifications You must be signed in to change notification settings

liweiyi88/integration

Repository files navigation

CircleCI Code Climate

Purpose

This project is to demonstrate the way to integrate application with third-party services by using asynchronous messaging (Background Worker & Message Queue). It also shows how to use ansible for provisioning and auto CI/CD pipeline by using CircleCI and Ansistrano.

How does this project work?

The demo

The application will save the form data into the database and push a message to AWS SQS after form submission. A background worker keeps running to poll the message from SQS and process it (pushing a new tweet to twitter in this case). This is a typical use case that "when something happens, we need to do a,b,c...". We can process a,b,c... in either a synchronous or asynchronous way which depends on your business rules.

Read my post for more explanations

Tools used by this project

  • Redis - it is used to determine whether to restart the background worker. It is inspired by Laravel Queue.
  • Supervisor - it is used to auto-restart workers if they are stopped by any exception.