onosproject / onos-config

Configuration subsystem for ONOS (µONOS Architecture)
45 stars 57 forks source link

gNMI client Subscribe() operation blocks the calling thread #1064

Closed ray-milkey closed 2 years ago

ray-milkey commented 4 years ago

If you use the Subscribe() function on a gNMI client to request a subscription from an onos-config instance the request will block. You have to wrap it in a goroutine to be able to get back any events.

Andrea-Campanella commented 4 years ago

I'm not sure this is an issue. I think that is the point of a subscribe, you want to continue be listening for events. at least that is how it's implemented in the gNMI subscriptions I've seen. how would you do it ?

kuujo commented 4 years ago

Is there a code example of what a working subscribe looks like? I can't find much from the docs.

Andrea-Campanella commented 4 years ago

@kuujo https://docs.onosproject.org/onos-config/docs/gnmi/ section Northbound Subscribe Request for Stream Notifications via gNMI

ray-milkey commented 4 years ago

@Andrea-Campanella the Subscribe() call blocks. There is no way to listen to events without another thread. This would make this API very hard to use for languages that don't supply threading, like Python.