astrohub

command module
v0.0.0-...-8da3b9b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2017 License: MIT Imports: 7 Imported by: 0

README

AstroHub

AstroHub is an in-memory request-response multiplexer for [micro]service oriented applications

Description

AstroHub is a service meant to sit between your "level 1" API servers or load balancers and your microservices. It allows services to communicate with one another through a centralized hub. This is the first in a set of Astro tools for building service oriented applications.

Details

AstroHub is written in Go, and leverages all of Go's robust realtime features to create a performant, low latency message bus.

AstroHub enables interaction with a microservice with a single request/response cycle. Microservices can interact with AstroHub using HTTP REST, or gRPC (coming soon). The Astro* spec will allow microservices to be deployed without any port requirements, ensuring easy deployments and no need for any centralized service discovery. The Astro* spec is still being designed, but the current iteration looks like so:

[Load Balancer] <--> [AstroServer(s)] <--> [AstroHub] <--> [Astro* Services]
												^
											Here we are

Documentation

Endpoints:
  • Queue up a "job" and recieve a response: POST: /service/{name}

    • Request:

      • {name} should be the name of the service you would like a response from
      • The request body should be an encoded JSON string.
        • Note: AstroHub will have no knowledge of the request body, it will just pass along the encoded JSON. It is the responsibility of the receiving service to decode the data.
    • Response:

      • Response body will consist of a JSON encoded response from the target service.
  • Get the next available "job" for a particular service: GET: /service/{name}/jobs

    • Request:

      • {name} should be the name of the service who's job you would like to process.
    • Response:

      • A JSON encoded representation of the job to be processed:

      {"id": [unique-uuid-v4 string], "originalRequest": [encoded JSON of original request]}

      • Note that the id will be used to post a response, so save it.
  • Send a response to a job: POST: /jobs/{id}

    • Request:

      • {id} should be the id of the job you recieved using /service/{name}/jobs.
      • The request body should be a JSON encoded string of your response data.
    • Response:

      • You will recieve an empty status 200 OK response when your response was sent successfully, or an appropriate HTTP error code if there was an error.
Notes:
  • Requests to /service/{name}/jobs can be long-lasting if no jobs are currently queued up. It may be smart to set timeouts on these requests and retry as appropriate. Astro* libraries will handle this automatically in the future. gRPC will also alleviate this issue.

  • In the future, we will be providing an astro-go library (and possibly others) which will mimic the standard net/http http server, and will be compatible with AstroHub

  • AstroHub is of course still in early development, so don't use it for anything important yet!

Coming soon:

  • gRPC support for hub <--> service communication
    • client <--> hub communication will always be HTTP REST
  • Docker image for easy deployment
  • Authentication
  • .Astrofile support (spec coming soon as well)

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL