Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Groovy - such property: DELEGATE_FIRST when mapping beans #529

Closed
weimeilin79 opened this issue Oct 21, 2020 · 0 comments · Fixed by #532
Closed

Groovy - such property: DELEGATE_FIRST when mapping beans #529

weimeilin79 opened this issue Oct 21, 2020 · 0 comments · Fixed by #532
Assignees

Comments

@weimeilin79
Copy link

weimeilin79 commented Oct 21, 2020

Error with when trying to do bean mapping in Groovy.

process('processInvoice')

Caused by: groovy.lang.MissingPropertyException: No such property: DELEGATE_FIRST for class: org.apache.camel.k.loader.groovy.dsl.BeansConfiguration
	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:65)
	at org.codehaus.groovy.vmplugin.v8.IndyGuardsFiltersAndSignatures.unwrap(IndyGuardsFiltersAndSignatures.java:172)
	at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:318)
	at org.apache.camel.k.loader.groovy.dsl.Support$Trait$Helper$_processor_closure1.doCall(Support.groovy:26)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

Code:

beans {
    processInvoice = processor {
        it.out.body = [
            orderId: it.in.body.orderId,
            itemId: it.in.body.itemId,
            department: 'invoicing',
            datetime: System.currentTimeMillis(),
            amount: (it.in.body.quantity * it.in.body.price),
            currency: 'USD',
            invoiceId: 'B-0' + (Math.floor(1000 + Math.random() * 9999))
        ]
        it.out.headers['reply-to'] = it.in.body.username
    }
}

from('amqp:topic:incomingorders?exchangePattern=InOnly')
    .log('Invoicing Notified ${body}')
    .unmarshal().json()
    .delay(30000).asyncDelayed()
    .process('processInvoice')
    .marshal().json()
    .convertBodyTo(String.class)
    .log('H:${headers}')
    .toD('amqp:topic:notifications?exchangePattern=InOnly')
    .to('log:info')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants