简体   繁体   English

Apache Camel脚本问题

[英]Apache Camel scripting problem

I have a very strange problem with Apache ActiveMQ with Camel - I tried the examples with javascript and groovy, but they both produce error "Failed to install route: Failed to create route... because of No language could be found for: groovy" 我有一个非常奇怪的问题与Apache ActiveMQ与Camel - 我尝试了javascript和groovy的例子,但他们都产生错误“无法安装路由:无法创建路由...因为没有语言可以找到:groovy”

The groovy example I use is 我使用的groovy例子是

<route>
    <from uri="queue:foo"/>
    <filter>
        <groovy>request.lineItems.any { i -> i.value > 100 }</groovy>
        <to uri="queue:bar"/>
    </filter>
</route>

The same issue goes for JavaScript. 同样的问题适用于JavaScript。 The only scripting that works is "Simple" - the internal Camel scripting language. 唯一有效的脚本是“简单” - 内部Camel脚本语言。 Please give me advice how to fix this. 请给我建议如何解决这个问题。 I am using ActiveMQ 5.2.4 with the integrated Apache Camel 2.4.0. 我使用ActiveMQ 5.2.4和集成的Apache Camel 2.4.0。

Do you have a dependency on camel-script fulfilled? 你对camel脚本有依赖吗?

For instance in maven this would be declared as: 例如,在maven中,这将被声明为:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-script</artifactId>
    <version>2.6.0</version>
</dependency>

In your <dependencies> declaration. <dependencies>声明中。

Yeah you need to add the JARs from camel-script and the scripting language of choice, eg for groovy you need the groovy JAR. 是的,你需要从camel脚本和选择的脚本语言中添加JAR,例如对于groovy,你需要groovy JAR。 If you run AMQ you should drop them in the lib folder. 如果您运行AMQ,则应将它们放在lib文件夹中。

I added artifact camel-groovy because camel-script didn't work for me. 我添加了神器camel-groovy,因为骆驼脚本对我不起作用。

<dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-groovy</artifactId>
        <version>2.23.0</version>
</dependency>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM