You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Remco Schoen <R....@topdesk.com> on 2017/08/15 12:26:29 UTC

Groovy DSL - expression closures

Hi,

I’m trying to get processor closures to work as described on:
http://camel.apache.org/groovy-dsl.html

But when I put the code below in a groovy file, it gives an error.

Should this work?

Kind regards,

Remco Schoen

The error:

groovy.lang.MissingMethodException: No signature of method: simpletest$1$_configure_closure1.doCall() is applicable for argument types: (org.apache.camel.impl.DefaultExchange, java.lang.Class) values: , ...]
Possible solutions: doCall(), doCall(java.lang.Object), findAll(), findAll()
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:286)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
at groovy.lang.Closure.call(Closure.java:414)
at org.codehaus.groovy.runtime.ConvertedClosure.invokeCustom(ConvertedClosure.java:54)
at org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:124)
at com.sun.proxy.$Proxy11.evaluate(Unknown Source)
at org.apache.camel.processor.SetPropertyProcessor.process(SetPropertyProcessor.java:51)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:541)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:120)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198)
at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:197)
at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:79)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)


The script:

@Grab('org.apache.camel:camel-core:2.19.1')
@Grab('org.slf4j:slf4j-simple:1.6.6')
import org.apache.camel.*
import org.apache.camel.impl.*
import org.apache.camel.builder.*

def camelContext = new DefaultCamelContext()
camelContext.addRoutes(new RouteBuilder() {
    def void configure() {
        from("timer://jdkTimer?period=3000")
                .to("log://camelLogger?level=INFO")
                .setProperty('henk') { 'aaa' }
    }
})
camelContext.start()

addShutdownHook{ camelContext.stop() }
synchronized(this){ this.wait() }



Re: Groovy DSL - expression closures

Posted by Remco Schoen <R....@topdesk.com>.
Hi,

I understand :)

Maybe an idea to mention on that page, that it is deprecated.

--

Met vriendelijke groet,


Remco Schoen

Op 23 aug. 2017, om 07:33 heeft Claus Ibsen <cl...@gmail.com>> het volgende geschreven:

Hi

The groovy DSL is deprecated and its not recommended to be used. We
have also deprecated Scala DSL as well.

Sorry but there is only as few we can maintain which is Java and XML.



On Tue, Aug 15, 2017 at 2:26 PM, Remco Schoen <R....@topdesk.com>> wrote:
Hi,

I’m trying to get processor closures to work as described on:
http://camel.apache.org/groovy-dsl.html

But when I put the code below in a groovy file, it gives an error.

Should this work?

Kind regards,

Remco Schoen

The error:

groovy.lang.MissingMethodException: No signature of method: simpletest$1$_configure_closure1.doCall() is applicable for argument types: (org.apache.camel.impl.DefaultExchange, java.lang.Class) values: , ...]
Possible solutions: doCall(), doCall(java.lang.Object), findAll(), findAll()
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:286)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
at groovy.lang.Closure.call(Closure.java:414)
at org.codehaus.groovy.runtime.ConvertedClosure.invokeCustom(ConvertedClosure.java:54)
at org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:124)
at com.sun.proxy.$Proxy11.evaluate(Unknown Source)
at org.apache.camel.processor.SetPropertyProcessor.process(SetPropertyProcessor.java:51)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:541)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:120)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198)
at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:197)
at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:79)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)


The script:

@Grab('org.apache.camel:camel-core:2.19.1')
@Grab('org.slf4j:slf4j-simple:1.6.6')
import org.apache.camel.*
import org.apache.camel.impl.*
import org.apache.camel.builder.*

def camelContext = new DefaultCamelContext()
camelContext.addRoutes(new RouteBuilder() {
   def void configure() {
       from("timer://jdkTimer?period=3000")
               .to("log://camelLogger?level=INFO")
               .setProperty('henk') { 'aaa' }
   }
})
camelContext.start()

addShutdownHook{ camelContext.stop() }
synchronized(this){ this.wait() }





--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: Groovy DSL - expression closures

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

The groovy DSL is deprecated and its not recommended to be used. We
have also deprecated Scala DSL as well.

Sorry but there is only as few we can maintain which is Java and XML.



On Tue, Aug 15, 2017 at 2:26 PM, Remco Schoen <R....@topdesk.com> wrote:
> Hi,
>
> I’m trying to get processor closures to work as described on:
> http://camel.apache.org/groovy-dsl.html
>
> But when I put the code below in a groovy file, it gives an error.
>
> Should this work?
>
> Kind regards,
>
> Remco Schoen
>
> The error:
>
> groovy.lang.MissingMethodException: No signature of method: simpletest$1$_configure_closure1.doCall() is applicable for argument types: (org.apache.camel.impl.DefaultExchange, java.lang.Class) values: , ...]
> Possible solutions: doCall(), doCall(java.lang.Object), findAll(), findAll()
> at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:286)
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
> at groovy.lang.Closure.call(Closure.java:414)
> at org.codehaus.groovy.runtime.ConvertedClosure.invokeCustom(ConvertedClosure.java:54)
> at org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:124)
> at com.sun.proxy.$Proxy11.evaluate(Unknown Source)
> at org.apache.camel.processor.SetPropertyProcessor.process(SetPropertyProcessor.java:51)
> at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
> at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:541)
> at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198)
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:120)
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
> at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198)
> at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:197)
> at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:79)
> at java.util.TimerThread.mainLoop(Timer.java:555)
> at java.util.TimerThread.run(Timer.java:505)
>
>
> The script:
>
> @Grab('org.apache.camel:camel-core:2.19.1')
> @Grab('org.slf4j:slf4j-simple:1.6.6')
> import org.apache.camel.*
> import org.apache.camel.impl.*
> import org.apache.camel.builder.*
>
> def camelContext = new DefaultCamelContext()
> camelContext.addRoutes(new RouteBuilder() {
>     def void configure() {
>         from("timer://jdkTimer?period=3000")
>                 .to("log://camelLogger?level=INFO")
>                 .setProperty('henk') { 'aaa' }
>     }
> })
> camelContext.start()
>
> addShutdownHook{ camelContext.stop() }
> synchronized(this){ this.wait() }
>
>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2