Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to implement nacos Registration Service

Shulou Source: shulou.com Published: 2022-06-01 09:21:07 10月05日 Update

Editor to share with you how to achieve nacos registration service, I hope you have something to gain after reading this article, let's discuss it together!

Registration Service @ NacosInjected private NamingService namingService; @ PostConstruct public void registerInstance () throws NacosException {/ / Registration Service namingService.registerInstance ("easy-nacos", "127.0.0.1", 8848) / / listener namingService.subscribe ("easy-nacos", new EventListener () {@ Override public void onEvent (Event event) {System.out.println ("Service name::" + ((NamingEvent) event) .getServiceName ()) System.out.println ("instance::" + ((NamingEvent) event) .getInstances ();}});} View service list public List get (@ RequestParam String serviceName) throws NacosException {System.out.println ("passed parameters > >" + serviceName) Return namingService.getAllInstances (serviceName);} after reading this article, I believe you have some understanding of "how to implement nacos Registration Service". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Tags: Services articles parameters done examples more listeners knowledge industry information information channels channels monitoring Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Xiaomi Huawei MariaDB OPPO Reno