Spring Cloud Dataflow scriptable-transform对于python语言失败

时间:2018-10-24 23:18:10

标签: spring-cloud-dataflow

最近,我下载了1.7.0版本并尝试部署以下内容

stream create amqp-to-hdfs --definition "mqtt-source-rabbit
--username=admin --password=pwd --url=/path/to/host--topics=dmj/ccs/sms/stream |
scriptable-transform --language=python --script='return \"payload\"' |
hdfs --fs-uri=hdfs://path/to/hdfs:9000 --directory=/path/to/recording --file-name=ingest"

但是,由于以下问题,此操作无法启动:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cloud.stream.app.scriptable.transform.processor.ScriptableTransformProcessorConfiguration': 
Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transformer' defined in
org.springframework.cloud.stream.app.scriptable.transform.processor.ScriptableTransformProcessorConfiguration: 
Invocation of init method failed; nested exception is
java.lang.IllegalArgumentException: javax.script.ScriptEngineManager is
unable to create a script engine for language 'python'

这很奇怪,因为我确实安装了python,并且如果将语言和脚本值更改为基于ruby的代码,则一切正常。但是,我需要使用Python来完成此任务。

任何想法

1 个答案:

答案 0 :(得分:0)

可编写脚本的转换器要求您声明函数,然后在函数定义结束时调用该函数

def myFunction(firstVar, lastVar):
    return firstVar +" some addition "+ lastVar;
myFunction("First ", " Second ")