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
-
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)