egg-eureka
Polling fetch Eureka registry and get instance info
This plugin runs on agent worker
and will send registry data to app worker when updated
then you could use ctx.app.getInstancesByAppId(appId)
to get instances by certain appId
Install
$ npm i egg-eureka --save
Usage
// {app_root}/config/plugin.jsexportseureka = enable: true package: 'egg-eureka'
Configuration
// {app_root}/config/config.default.jsexportseureka = instance: hostName: 'egg-eureka-app.local' // secureVipAddress: '', // vipAddress: '', homePageUrl: '/' // just path, will automatically join with ip and port or hostname if given statusPageUrl: '/info' // just path, will automatically join with ip and port or hostname if given healthCheckUrl: '/health' // just path, will automatically join with ip and port or hostname if given registry: server: 'http://localhost:32768/eureka/v2/apps/' // if use eureka cluster, then pass an (Array<url>, or String split by ',') eg: ['eureka1host/path','eureka2/path] or 'eureka1host/path, eureka2host/path' heartbeatInterval: 5000 registryFetchInterval: 1000 //... other config follow eureka-js-client https://github.com/jquatier/eureka-js-client#advanced-configuration-options
see config/config.default.js for more detail.
Example
Questions & Suggestions
Please open an issue here.