| 251 | } |
| 252 | |
| 253 | func ExampleService_Reset() { |
| 254 | nc, err := nats.Connect("127.0.0.1:4222") |
| 255 | if err != nil { |
| 256 | log.Fatal(err) |
| 257 | } |
| 258 | defer nc.Close() |
| 259 | |
| 260 | config := micro.Config{ |
| 261 | Name: "EchoService", |
| 262 | Version: "0.1.0", |
| 263 | } |
| 264 | |
| 265 | srv, _ := micro.AddService(nc, config) |
| 266 | |
| 267 | // reset endpoint stats on this service |
| 268 | srv.Reset() |
| 269 | |
| 270 | empty := micro.Stats{ |
| 271 | ServiceIdentity: srv.Info().ServiceIdentity, |
| 272 | } |
| 273 | if !reflect.DeepEqual(srv.Stats(), empty) { |
| 274 | log.Fatal("Expected endpoint stats to be empty") |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | func ExampleContextHandler() { |
| 279 | nc, err := nats.Connect("127.0.0.1:4222") |