可编写脚本的Java转换Spring云数据流

时间:2018-10-05 22:17:00

标签: javascript spring-cloud-stream spring-cloud-dataflow

我正在尝试使用可脚本化的转换和JavaScript来解析来自Rabbit的json负载。但是出现错误。

流定义

兔子--password ='******'--queues = springdataflow-q10 --host = 172.24.172.184 --virtual-host = springdataflow --username = springdataflow | scriptable-transform --language = javascript --script ='function extract(a)\ n {\ n var obj = JSON.parse(payload); \ n return obj.customerId; \ n} \ nextract(payload);' |日志

版本

Spring云数据流版本为1.5.2,转换版本为。 maven://org.springframework.cloud.stream.app:scriptable-transform-processor-kafka‑10:1.3.1.RELEASE

错误

该流部署良好,但是在转换位的日志上,我遇到一个奇怪的错误: docker exec -it数据流服务器tail -f /tmp/spring-cloud-deployer-8103682307576658371/json-parse-js-1538777252915/json-parse-js.scriptable-transform/stdout_0.log         在org.springframework.kafka.listener.adapter.RetryingAcknowledgingMessageListenerAdapter.onMessage(RetryingAcknowledgingMessageListenerAdapter.java:73)〜[spring-kafka-1.1.7.RELEASE.jar!/:na]         在org.springframework.kafka.listener.adapter.RetryingAcknowledgingMessageListenerAdapter.onMessage(RetryingAcknowledgingMessageListenerAdapter.java:39)〜[spring-kafka-1.1.7.RELEASE.jar!/:na]         在org.springframework.kafka.listener.KafkaMessageListenerContainer $ ListenerConsumer.invokeRecordListener(KafkaMessageListenerContainer.java:792)上[spring-kafka-1.1.7.RELEASE.jar!/:na]         在org.springframework.kafka.listener.KafkaMessageListenerContainer $ ListenerConsumer.invokeListener(KafkaMessageListenerContainer.java:736)上[spring-kafka-1.1.7.RELEASE.jar!/:na]         在org.springframework.kafka.listener.KafkaMessageListenerContainer $ ListenerConsumer.access $ 2100(KafkaMessageListenerContainer.java:246)[spring-kafka-1.1.7.RELEASE.jar!/:na]         在org.springframework.kafka.listener.KafkaMessageListenerContainer $ ListenerConsumer $ ListenerInvoker.run(KafkaMessageListenerContainer.java:1025)处[spring-kafka-1.1.7.RELEASE.jar!/:na]         在java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511)[na:1.8.0_111-内部]         在java.util.concurrent.FutureTask.run(FutureTask.java:266)[na:1.8.0_111-内部]         在java.lang.Thread.run(Thread.java:745)[na:1.8.0_111-internal]

感谢您的帮助!

0 个答案:

没有答案