Giter VIP home page Giter VIP logo

danketsu's Introduction

団結

Danketsu

A simple event-based microservice communication microservice. Operates on an user-defined port over HTTP using JSON. Also insanely fast, typical requests take about 50ms on a local workstation.

Usage

Compile with go build.

The binary takes an optional parameter -port, which defaults to 8080.

The APIv1 can be reached via HTTP POST at http://server:port/api/v1/ and defines the following interactions:

Registering a callback

{
    "action": "register",
    "event": "users_new_user_created",
    "address": "http://deimos.company.local:1338/api/v1/"
}

Unregistering a callback

{
    "action": "unregister",
    "event": "users_new_user_created",
    "address": "http://deimos.company.local:1338/api/v1/"
}

Firing an event

{
    "action": "fire",
    "event": "users_new_user_created",
    "payload": "{
	\"username\": \"sulami\"
    }"
}

The addresses passed are the ones for the callbacks, so Danketsu knows who to message in case an event occurs. The payload is JSON packed into a bytearray and is completely ignored by Danketsu and just passed to all receivers, so they can use the additional infos. Keep in mind that quotation marks have to be escaped, or bad things will happen.

There is also a status page at http://server:port/status/ which currently returns the number of fired events in the last 24 hours and the number of registered callbacks in JSON-form when called via HTTP GET.

There is no internal event database, which means events are not more than arbitrary strings. You can register for events that do no exists and can fire events that are not registered anywhere.

The server will return HTTP status code 200 in any case, except when the input data is malformed, in which case it will return HTTP status code 400.

danketsu's People

Contributors

sulami avatar

Stargazers

 avatar

Watchers

 avatar  avatar  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.