I'm trying to refactor some code to be inside a worker and getting an error:
undefined symbol userId
Seems the worker is unable to see variables from the scope above it. How can I get the worker to see the parameter being passed in?
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);