scalecube-js
scalecube-js copied to clipboard
Subscribe to registry
General description
subscribe to the registry to receive the current state of the system.
(debug purpose)
Why not adding the information to debug? if debug will show the registry state then it will add a lot of noise to the logs.
subscribe to it will allow to opt-in/out from this information in runtime.
API
Design proposition
A clear and concise description of the design proposition.
-
[x] Is backward compatible
-
[x] Adds new API
-
[x] Changes existing API
Pull Request
[Link]
Old API
interface Microservice {
/**
* @method destroy
* The method is used to delete a microservice and close all the subscriptions related with it
*/
destroy: () => Promise<any>;
/**
* @method createProxy
* Creates a proxy to a method and provides extra logic when is invoked
*/
createProxy: CreateProxy;
/**
* @method createServiceCall
* Exposes serviceCall to a user (not via Proxy)
*/
createServiceCall: CreateServiceCall;
}
New API
interface Microservice {
/**
* @method destroy
* The method is used to delete a microservice and close all the subscriptions related with it
*/
destroy: () => Promise<any>;
/**
* @method createProxy
* Creates a proxy to a method and provides extra logic when is invoked
*/
createProxy: CreateProxy;
/**
* @method createServiceCall
* Exposes serviceCall to a user (not via Proxy)
*/
createServiceCall: CreateServiceCall;
/**
* @function listenToRegistry
* subscribe to registry
*/
listenToRegistry : () => Obseravble<RegistryState>
}
interface RegistryState {
[qualifier : string] : Endpoint[]
}
-
[ ] API has been approved
-
[ ] Discussed with Technical lead
Definition of Done
- [ ] Documentation