tail-f-systems / JNC

JNC (Java NETCONF Client) is the name of a Java library for communicating with NETCONF agents, and a plugin for pyang (http://code.google.com/p/pyang/) to generate Java classes from YANG models, to be used by the JNC library.
Other
77 stars 87 forks source link

How to receive notification from multiple NetConf devices? #56

Open murugesan76 opened 8 years ago

murugesan76 commented 8 years ago

The receiveNotification() method in NetconfSession.java is to receive notification from one device using the NetconfSession. The thread which executes this method will be blocked till the notification is received from the device. So I need a separate thread for each device to receive the notification from them. I cannot afford to have one dedicated thread for each device. I would like to receive notification from multiple devices and those notifications from multiple devices should be handled by a single thread instead of one thread per device. Please let me know how to achieve this use case.

klacke commented 8 years ago

Problematic, it's indeed a blocking call here. The only solution I can come up with is to add timeout support to receiveNotification and have a single thread loop through all devices with a timeout. Far from great but workable.

I did some googling here for you, i.e http://www.scriptscoop.net/t/f34a91700f3e/java-nio-socketchannel-client-to-multiple-servers.html Read for example the boring comment: "... Use JSch or Ganymed SSH or one of the other SSH libraries, threads, and get on with your life."

So - please go ahead - and try to add timeout support.

Thanks

/klacke

murugesan76 commented 8 years ago

Thanks for your response klacke

murthy-nn commented 2 years ago

If you had found a solution, please elaborate for the benefit of the forum.

murthy-nn commented 2 years ago

The link is not working. Any alternate? http://www.scriptscoop.net/t/f34a91700f3e/java-nio-socketchannel-client-to-multiple-servers.html

Problematic, it's indeed a blocking call here. The only solution I can come up with is to add timeout support to receiveNotification and have a single thread loop through all devices with a timeout. Far from great but workable.

I did some googling here for you, i.e http://www.scriptscoop.net/t/f34a91700f3e/java-nio-socketchannel-client-to-multiple-servers.html Read for example the boring comment: "... Use JSch or Ganymed SSH or one of the other SSH libraries, threads, and get on with your life."

So - please go ahead - and try to add timeout support.

Thanks

/klacke