-
-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Service discovery #1423
Comments
I would add the possibility for an example key (may optional) .
|
It's interesting to note that Vert.x has a service discovery library: https://vertx.io/docs/vertx-service-discovery/java/ Having said that, we could offer a REST API as a bridge and still leverage Vert.x service discovery library.
What would be the purpose? |
to provide an example for a client application e.g. https://kroki.io. When you build something like that you may don't want to change your code for every new service provided via the api. |
The goal is to allow the gateway server to register additional diagram libraries (that are not built-in).
One of the requirement will be to adhere to the Kroki companion container API specification (not yet available).
Proposal
Discovery
When the gateway server starts, it will probe the seed addresses by connecting to each address and attempting to identify the service. If successful, it will register a new service.
This solution implies that the service must provide information (at least a unique name, a version, and a list of supported formats).
Static registration
Alternatively, we could explicitly register services:
In this case, the service does not have to expose an API that provides information.
Dynamic registration
We could also support dynamic registration. In this case, the companion service will be responsible for registering itself by sending a request to the gateway server.
201 created
: service registration is successful422 unprocessable entity
: non-unique name (service is probably already registered)400 bad request
: request payload is invalid500
: unexpected errorSince Kroki is stateless, registry is held in memory. As a result, the companion service is responsible for registering again in case the gateway server is restarted.
For this reasons, services should send a heartbeat:
200 ok
: service found404 not found
: service is not registered (use_links
to indicate how to register)500
: unexpected errorA service that receives a 404 during a heartbeat could then register again.
The gateway service will provide information about a registred service:
200 ok
: service found404 not found
: service is not registered500
: unexpected errorNote: Last activity date is the last time a service sent a heartbeat or respond to a request from the gateway server.
I will also provide a list of all services currently registered:
Unregister
A service can unregister (for instance when the service is shutting down) using:
200 ok
: service removed404 not found
: service is not registered500
: unexpected errorThe text was updated successfully, but these errors were encountered: