Code Monkey home page Code Monkey logo

webhook-to-amqp's Introduction

Webhook to RabbitMQ / AMQP

This simple project logs webhook events in to a RabbitMQ queue. The benefit of this is to allow webhooks to be executed by a background task rather than syncronously. This allows webhooks to withstand application failure, allows webhooks to scale and allows the application to control processing speed. It is designed to work with Heroku and require no installation.

Setup

  1. Create app in Heroku
  2. Deploy this repository
  3. Set a AMQP_SERVER environmental variable in Heroku to point to your Queue Server
  4. Optionally the queue routing key can be changed with a AMQP_ROUTING_KEY variable. The default is webhooks

Usage

The service is designed to handle any url, method, headers and body content input and log it against the queue task in a simple json format. An example is below

{
  "Method": "GET",
  "Url": {
    "Scheme": "",
    "Opaque": "",
    "User": null,
    "Host": "",
    "Path": "\/what",
    "RawPath": "",
    "RawQuery": "",
    "Fragment": ""
  },
  "Headers": {
    "Accept": [
      "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,*\/*;q=0.8"
    ],
    "Accept-Encoding": [
      "gzip, deflate, sdch"
    ],
    "Accept-Language": [
      "en-US,en;q=0.8"
    ],
    "Cache-Control": [
      "max-age=0"
    ],
    "Connection": [
      "keep-alive"
    ],
    "Upgrade-Insecure-Requests": [
      "1"
    ],
    "User-Agent": [
      "Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/49.0.2623.87 Safari\/537.36"
    ]
  },
  "Body": ""
}

This allows workers to consume the queue and handle the allocation of each task to its relevant processor.

webhook-to-amqp's People

Contributors

evulse avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.