mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-24 10:07:04 +02:00
Update subscriber name
This commit is contained in:
parent
fcbd2acdde
commit
763608854b
@ -50,9 +50,13 @@ func newSubscriber(topic string, sub interface{}) Subscriber {
|
|||||||
Request: extractSubValue(typ),
|
Request: extractSubValue(typ),
|
||||||
Metadata: map[string]string{
|
Metadata: map[string]string{
|
||||||
"topic": topic,
|
"topic": topic,
|
||||||
|
"subscriber": "true",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
hdlr := reflect.ValueOf(sub)
|
||||||
|
name := reflect.Indirect(hdlr).Type().Name()
|
||||||
|
|
||||||
for m := 0; m < typ.NumMethod(); m++ {
|
for m := 0; m < typ.NumMethod(); m++ {
|
||||||
method := typ.Method(m)
|
method := typ.Method(m)
|
||||||
h := &handler{
|
h := &handler{
|
||||||
@ -70,10 +74,11 @@ func newSubscriber(topic string, sub interface{}) Subscriber {
|
|||||||
handlers = append(handlers, h)
|
handlers = append(handlers, h)
|
||||||
|
|
||||||
endpoints = append(endpoints, ®istry.Endpoint{
|
endpoints = append(endpoints, ®istry.Endpoint{
|
||||||
Name: method.Name,
|
Name: name + "." + method.Name,
|
||||||
Request: extractSubValue(method.Type),
|
Request: extractSubValue(method.Type),
|
||||||
Metadata: map[string]string{
|
Metadata: map[string]string{
|
||||||
"topic": topic,
|
"topic": topic,
|
||||||
|
"subscriber": "true",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user