2017-08-08 104 views
0

有什么办法可以通过invokeHttp nifi处理器调用远程休息服务,并且永久地改变它的url。在我的情况下,我需要通过2个参数来获取请求,我需要一次又一次地改变它们。有没有可用于将我的参数写入属性的nifi处理器,并将其与invokehttp进行连接?我在invokehttp远程URL中的参数会改变,是否有任何处理器或可能有几个处理器可以帮助我完成这项任务?如何在InvokeHttp nifi处理器中调用远程休息服务?

回答

0

Bryan answered this with a comment回复您的上一个问题。

要提供在请求URI中用作参数的动态值,只需使用Apache NiFi Expression Language引用传入流文件中的参数。许多处理器可以提供这些属性,但UpdateAttribute可能是您想要开始的位置。例如,如果处理器设置了两个属性(usernamethreshold),你会喜欢这一系列flowfiles的:

  1. Flowfile 1 | username 'andy' | threshold '27'
  2. Flowfile 2 | username 'bryan' | threshold '12'
  3. Flowfile 3 | username 'sally' | threshold '22'

InvokeHTTP处理器会配置一个URI,如https://my.remote.service:8080/incoming?username=${username}&threshold=${threshold}。因此,当flowfiles通过处理器,你传出HTTP请求是:

  1. https://my.remote.service:8080/incoming?username=andy&threshold=27
  2. https://my.remote.service:8080/incoming?username=bryan&threshold=12
  3. https://my.remote.service:8080/incoming?username=sally&threshold=22
+0

谢谢,这是有益的:d –