是否有一种方法可以在Anypoint平台上获取端点列表

问题描述 投票:0回答:1

我正在寻找通过CLI或anypoint REST API通过anypoint平台公开的端点的列表。即使它是应用程序的端点列表,我也可以将它们一起编译。

mule anypoint-studio mulesoft
1个回答
0
投票

您基本上可以通过遍历流程来获取端点列表。就我而言,我只有接受POST和GET请求的端点,因此我的示例基于此:

Collection<FlowConstruct> flowConstructs = muleEventContext.getMuleContext()
                                                           .getRegistry()
                                                           .lookupFlowConstructs(); 
Iterator<FlowConstruct> iterator = flowConstructs.iterator();
while (iterator.hasNext()) {
    String flowName = iterator.next().getName();
    if (flowName.startsWith("post:") || flowName.startsWith("get:")) {
        Flow flow = muleEventContext.getMuleContext().getRegistry().get(flowName);
        // You can process the flowName to extract endpoint
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.