1function mcp_config_pools() 2 mcp.backend_connect_timeout(60) 3 mcp.backend_read_timeout(60) 4 mcp.backend_retry_timeout(60) 5 local b1 = mcp.backend('b1', '127.0.0.1', 12171) 6 return mcp.pool({b1}) 7end 8 9function mcp_config_routes(p) 10 local fg = mcp.funcgen_new() 11 local h = fg:new_handle(p) 12 fg:ready({ 13 n = "match", f = function(rctx) 14 return function(r) 15 local res = rctx:enqueue_and_wait(r, h) 16 local match, token = r:match_res(res) 17 if match then 18 mcp.log("match succeeded") 19 else 20 if token then 21 mcp.log("match failed: " .. token) 22 else 23 mcp.log("match failed: no token") 24 end 25 end 26 return res 27 end 28 end 29 }) 30 mcp.attach(mcp.CMD_MG, fg) 31 mcp.attach(mcp.CMD_MS, fg) 32end 33