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
can't use a function processor with javascript #1035
Comments
Can you add the full javascript code ? there are some know limitation of the javascript interpreter that need to be workaround. i.e. you may need to do something like: https://github.com/apache/camel-k-runtime/blob/master/camel-k-loader-js/src/test/resources/routes-with-processors.js |
script
|
you need to wrap it with one of the options shown here |
changed to wrapper, no crash but now looks like function is not updating the body
called returned:
expected: |
a processor is supposed to change the content of the exchange whereas here your wrapped function does jot alter the exchange but return something that is ignored |
Ok, refactored to modify body using:
It returns expected value but body is in different format: What is the correct way to retrieve the body as String? |
does the trick! |
When trying to call .process(function) in javascript i'm getting:
[19] Exception in thread "main" TypeError: invokeMember on JavaObject[Route[From[direct:notify] -> [Log[Inventory Notified ${body}]]] (org.apache.camel.model.RouteDefinition)] failed due to: Multiple applicable overloads found for method name process (candidates: [Method[public org.apache.camel.model.ProcessorDefinition org.apache.camel.model.ProcessorDefinition.process(java.util.function.Supplier)], Method[public org.apache.camel.model.ProcessorDefinition org.apache.camel.model.ProcessorDefinition.process(org.apache.camel.Processor)]], arguments: [DynamicObject<JSFunction>@719843e5 (DynamicObjectBasic)])
The text was updated successfully, but these errors were encountered: