2017-10-06 153 views
2

我需要創建一個自定義EL功能並在uri-template(相當於YEAR,MONTH)中使用它。 有可能嗎?協調員這個區域的關鍵配置是oozie-site.xmlOozie協調器 - 自定義EL功能

+0

歡迎來到SO!爲了從您的問題中獲得最大的收益,請提供儘可能多的細節。在這種情況下,請添加workflow.xml和coordinator.xml以及更多您所修改的錯誤 – Mzf

+0

Hi @Mzf,謝謝您的回覆。 我改寫了我的問題 – Sandro

回答

0

屬性oozie.service.ELService.ext.functions.workflow是您必須將擴展EL功能的所有映射包括到關聯的類和方法中的屬性。多個映射條目以逗號分隔。

<property> 
<name>oozie.service.ELService.ext.functions.workflow</name> 
<value> 
yourELkey=fully_quallified_class_name#static_method_name 
</value> 
<description> 
EL functions declarations, separated by commas, format is 
[PREFIX:]NAME=CLASS#METHOD. This property is a convenience 
property to add extensions to the built in executors without 
having to include all the built in ones. 
</description> 
</property> 

有關如何打包和部署的更多信息,請參閱this

編輯:由於您對類似於YEAR,MONTH的協調員的EL函數感興趣,您可以看看下面的屬性(記錄在oozie-default.xml中,您需要將它添加到oozie-site。因爲前者只是文檔) - oozie.service.ELService.functions.coord-job-submit-freqoozie.service.ELService.ext.functions.coord-job-submit-freq

<property> 
     <name>oozie.service.ELService.functions.coord-job-submit-freq</name> 
     <value> 
      coord:days=org.apache.oozie.coord.CoordELFunctions#ph1_coord_days, 
      coord:months=org.apache.oozie.coord.CoordELFunctions#ph1_coord_months, 
      coord:hours=org.apache.oozie.coord.CoordELFunctions#ph1_coord_hours, 
      coord:minutes=org.apache.oozie.coord.CoordELFunctions#ph1_coord_minutes, 
      coord:endOfDays=org.apache.oozie.coord.CoordELFunctions#ph1_coord_endOfDays, 
      coord:endOfMonths=org.apache.oozie.coord.CoordELFunctions#ph1_coord_endOfMonths, 
      coord:conf=org.apache.oozie.coord.CoordELFunctions#coord_conf, 
      coord:user=org.apache.oozie.coord.CoordELFunctions#coord_user, 
      hadoop:conf=org.apache.oozie.action.hadoop.HadoopELFunctions#hadoop_conf 
     </value> 
     <description> 
      EL functions declarations, separated by commas, format is [PREFIX:]NAME=CLASS#METHOD. 
     </description> 
    </property> 

    <property> 
     <name>oozie.service.ELService.ext.functions.coord-job-submit-freq</name> 
     <value> 
     </value> 
     <description> 
      EL functions declarations, separated by commas, format is [PREFIX:]NAME=CLASS#METHOD. 
      This property is a convenience property to add extensions to the built in executors without having to 
      include all the built in ones. 
     </description> 
    </property> 
+0

謝謝@Shailendra!我已經閱讀了教程,並且能夠在工作流中使用自定義函數,但在協調器內部它不起作用。我認爲屬性'oozie.service.ELService.ext.functions.workflow'只能用於工作流程 – Sandro

+0

哦,我看到了 - 請參閱我的編輯。 – Shailendra

+0

@Shailendra請看這個問題 https://stackoverflow.com/questions/47622084/oozie-custom-el-function-oozie-for-coordinator – aibotnet