2017-08-08 28 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 –