MCPcopy
hub / github.com/nats-io/nats.go / ExampleService_Info

Function ExampleService_Info

micro/example_test.go:153–174  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

151}
152
153func ExampleService_Info() {
154 nc, err := nats.Connect("127.0.0.1:4222")
155 if err != nil {
156 log.Fatal(err)
157 }
158 defer nc.Close()
159
160 config := micro.Config{
161 Name: "EchoService",
162 }
163
164 srv, _ := micro.AddService(nc, config)
165
166 // service info
167 info := srv.Info()
168
169 fmt.Println(info.ID)
170 fmt.Println(info.Name)
171 fmt.Println(info.Description)
172 fmt.Println(info.Version)
173 fmt.Println(info.Endpoints)
174}
175
176func ExampleService_Stats() {
177 nc, err := nats.Connect("127.0.0.1:4222")

Callers

nothing calls this directly

Calls 4

AddServiceFunction · 0.92
ConnectMethod · 0.80
InfoMethod · 0.65
CloseMethod · 0.45

Tested by

no test coverage detected