@qmatic/service-discovery
v0.0.10
Published
Qmatic logic for cloud service discovery
Keywords
Readme
Description
This package will look up service URLs in AWS CloudMap. It will by default use the "services" namespace, but can use other namespaces as well. Returns a list of strings that are the combination of the AWS_INSTANCE_IPV4 and AWS_INSTANCE_PORT attributes registered in CloudMap. The formation is "http://<AWS_INSTANCE_IPV4>:<AWS_INSTANCE_PORT>", e.g. "http://127.0.0.1:8080"
Installation
npm install @qmatic/service-discoveryExample typescript usage using default namespace
import {ServiceDiscovery, ServiceDiscoveryFactory} from "@qmatic/service-discovery";
let serviceDiscoveryFactory: ServiceDiscoveryFactory = new ServiceDiscovery()
serviceDiscoveryFactory.getUrls("myservicename").then((urls: Array<string>) => {
urls.forEach((url: string) => {
console.log("URL: " + url)
})
})Example typescript usage using custom namespace
import {ServiceDiscovery, ServiceDiscoveryFactory} from "@qmatic/service-discovery";
let serviceDiscoveryFactory: ServiceDiscoveryFactory = new ServiceDiscovery()
serviceDiscoveryFactory.getUrls("myservicename", "mycustomnamespace").then((urls: Array<string>) => {
urls.forEach((url: string) => {
console.log("URL: " + url)
})
})