NiFi 动态创建对 InvokeHTTP 的请求

NiFi Dynamically create requests for InvokeHTTP

NiFi 新手!

我有一个场景,我发出一个休息请求并取回一些数据。我收到的数据包含一个 ID,我需要用它来发出后续请求。例如:

调用 HTTP GET 要求:

  1. http://localhost:2999/names

结果:

[
    {
        id: 123
    },
    {
        id: 345
    }
]

调用 HTTP GET 要求:

  1. http://localhost:2999/id/123/rest/of/url
  2. http://localhost:2999/id/345/rest/of/url

有什么方法可以assemble把上面的两个请求传递给NiFi中的InvokeHTTP吗?

提前致谢!

如果响应在 JSON 中,您可能想要使用 SplitJson to split the array into separate flowfiles, then use EvaluateJSONPath to extract the id values into flowfile attributes (one per flowfile). From there, you can feed those flowfiles into another InvokeHTTP 处理器并引用相关的属性值。