我正在尝试将一些代码重构为在工作人员内部并出现错误:
未定义的符号 userId
似乎工作人员无法从其上方的范围内看到变量。如何让工作人员看到传入的参数?
import ballerina.net.http;
import ballerina.lang.messages;
import ballerina.lang.jsons;
@http:BasePath ("/foo")
service barApi {
http:ClientConnector endpointEP = create http:ClientConnector("http://example.com");
@http:GET
@http:Path("/users/{userId}")
resource users (message m,
@http:PathParam("userId") string userId) {
worker sampleWorker(message m) {
string requestPath = "/user/" + userId;
message response = http:ClientConnector.get(endpointEP, requestPath, m);