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

Function ExampleControlSubject

micro/example_test.go:309–327  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

307}
308
309func ExampleControlSubject() {
310
311 // subject used to get PING from all services
312 subjectPINGAll, _ := micro.ControlSubject(micro.PingVerb, "", "")
313 fmt.Println(subjectPINGAll)
314
315 // subject used to get PING from services with provided name
316 subjectPINGName, _ := micro.ControlSubject(micro.PingVerb, "CoolService", "")
317 fmt.Println(subjectPINGName)
318
319 // subject used to get PING from a service with provided name and ID
320 subjectPINGInstance, _ := micro.ControlSubject(micro.PingVerb, "CoolService", "123")
321 fmt.Println(subjectPINGInstance)
322
323 // Output:
324 // $SRV.PING
325 // $SRV.PING.CoolService
326 // $SRV.PING.CoolService.123
327}
328
329func ExampleRequest_Respond() {
330 handler := func(req micro.Request) {

Callers

nothing calls this directly

Calls 1

ControlSubjectFunction · 0.92

Tested by

no test coverage detected