Skip to content
This repository has been archived by the owner on Aug 18, 2023. It is now read-only.

PDOK/go-eureka-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Go Eureka Client

Based on code from https://github.com/ArthurHlt/go-eureka-client and https://github.com/bryanstephens/go-eureka-client .

Getting started

import (
	"github.com/pdok/go-eureka-client/eureka"
)
func main() {

	client := eureka.NewClient([]string{
		"http://127.0.0.1:8761/eureka", //From a spring boot based eureka server
		// add others servers here
	})
	instance := eureka.NewInstanceInfo("test.com", "test", "69.172.200.235", 80, false) //Create a new instance to register
	client.RegisterInstance(instance) // Register new instance in your eureka(s)
	applications, _ := client.GetApplications() // Retrieves all applications from eureka server(s)
	client.GetApplication(instance.App) // retrieve the application "test"
	client.GetInstance(instance.App, instance.HostName) // retrieve the instance from "test.com" inside "test"" app
	client.SendHeartbeat(instance.HostName) // say to eureka that your app is alive (here you must send heartbeat before 30 sec)
}

All these strange behaviour come from Eureka.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages