{"record":{"id":"502613877564dd0e","repo":"alibaba/nacos","slug":"do-not-support-subscribe-service-by-udp-please-us","errorCode":null,"errorMessage":"Do not support subscribe service by UDP, please use gRPC replaced.","messagePattern":"Do not support subscribe service by UDP, please use gRPC replaced\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"client/src/main/java/com/alibaba/nacos/client/naming/remote/http/NamingHttpClientProxy.java","lineNumber":341,"sourceCode":"        String result = reqApi(UtilAndComs.nacosUrlBase + \"/service/list\", params, HttpMethod.GET);\n        \n        Map<String, Object> json =\n            JsonUtils.toObj(result, new NacosTypeReference<Map<String, Object>>() {\n            });\n        ListView<String> listView = new ListView<>();\n        Object count = json.get(\"count\");\n        listView.setCount(count instanceof Number ? ((Number) count).intValue() : 0);\n        listView.setData(JsonUtils.toObj(JsonUtils.toJson(json.get(\"doms\")),\n            new NacosTypeReference<List<String>>() {\n            }));\n        \n        return listView;\n    }\n    \n    @Override\n    public ServiceInfo subscribe(String serviceName, String groupName, String clusters)\n        throws NacosException {\n        throw new UnsupportedOperationException(\n            \"Do not support subscribe service by UDP, please use gRPC replaced.\");\n    }\n    \n    @Override\n    public void unsubscribe(String serviceName, String groupName, String clusters)\n        throws NacosException {\n    }\n    \n    @Override\n    public boolean isSubscribed(String serviceName, String groupName, String clusters)\n        throws NacosException {\n        return true;\n    }\n    \n    public String reqApi(String api, Map<String, String> params, String method)\n        throws NacosException {\n        return reqApi(api, params, Collections.EMPTY_MAP, method);\n    }","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/client/src/main/java/com/alibaba/nacos/client/naming/remote/http/NamingHttpClientProxy.java#L323-L359","documentation":"Thrown by NamingHttpClientProxy.subscribe (UnsupportedOperationException). Service subscription (push-based change notifications) over UDP/HTTP is not supported — the HTTP proxy provides no real-time subscription channel. Subscriptions require the gRPC proxy, which maintains a persistent stream.","triggerScenarios":"Calling NamingService.subscribe or equivalent on a NamingService backed by the HTTP client proxy. The HTTP proxy's subscribe method is a stub that always throws.","commonSituations":"Application relies on event-driven service change notifications but is configured with HTTP transport; legacy code that assumes subscription works over HTTP.","solutions":["Switch to the gRPC naming client proxy — subscriptions require the gRPC push channel.","If HTTP is mandatory, poll getAllInstances periodically as a fallback (with the cost of latency).","Ensure the client configuration enables gRPC as the transport for naming."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// For HTTP transport, use polling instead of subscribe\nif (isHttpTransport(namingService)) {\n    // poll getAllInstances periodically\n    ScheduledExecutorService scheduler = ...;\n    scheduler.scheduleAtFixedRate(() -> {\n        List<Instance> instances = namingService.getAllInstances(serviceName);\n        // process changes\n    }, 0, 5, TimeUnit.SECONDS);\n} else {\n    namingService.subscribe(serviceName, eventListener);\n}","typeGuard":null,"tryCatchPattern":"try {\n    namingService.subscribe(serviceName, groupName, clusters, eventListener);\n} catch (UnsupportedOperationException e) {\n    if (e.getMessage().contains(\"subscribe service by UDP\")) {\n        // fall back to polling\n        startPollingFallback(serviceName, groupName, clusters);\n    } else {\n        throw e;\n    }\n}","preventionTips":["Use gRPC transport for service subscriptions.","For HTTP-only deployments, implement a polling fallback with an appropriate interval.","Document that real-time push notifications require gRPC."],"tags":["naming","http-proxy","subscribe","unsupported","client"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}