2017-10-06 53 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