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

'context' object not available in JavaScript integrations #1346

Closed
lmorandini opened this issue Mar 15, 2020 · 0 comments · Fixed by apache/camel-k-runtime#342
Closed

'context' object not available in JavaScript integrations #1346

lmorandini opened this issue Mar 15, 2020 · 0 comments · Fixed by apache/camel-k-runtime#342
Milestone

Comments

@lmorandini
Copy link

While the integrations generally work in Camel-K 1.0.0.-RC2 , the 'context' object is not available:
const amq = context.getComponent('activemq');
causes:

[1] Exception in thread "main" ReferenceError: context is not defined
[1]     at <js> :program(Unnamed:3:142-148)
[1]     at org.graalvm.polyglot.Context.eval(Context.java:370)
[1]     at org.apache.camel.k.loader.js.JavaScriptSourceLoader$1.configure(JavaScriptSourceLoader.java:62)
[1]     at org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:471)
[1]     at org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:438)
[1]     at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:418)
[1]     at org.apache.camel.impl.engine.AbstractCamelContext.lambda$addRoutes$0(AbstractCamelContext.java:1119)
[1]     at org.apache.camel.impl.engine.AbstractCamelContext.doWithDefinedClassLoader(AbstractCamelContext.java:2460)
[1]     at org.apache.camel.impl.engine.AbstractCamelContext.addRoutes(AbstractCamelContext.java:1119)
[1]     at org.apache.camel.main.RoutesConfigurer.configureRoutes(RoutesConfigurer.java:84)
[1]     at org.apache.camel.main.BaseMainSupport.postProcessCamelContext(BaseMainSupport.java:570)
[1]     at org.apache.camel.main.BaseMainSupport.initCamelContext(BaseMainSupport.java:422)
[1]     at org.apache.camel.k.main.ApplicationRuntime$MainAdapter.doInit(ApplicationRuntime.java:180)
[1]     at org.apache.camel.support.service.ServiceSupport.init(ServiceSupport.java:80)
[1]     at org.apache.camel.support.service.ServiceSupport.start(ServiceSupport.java:108)
[1]     at org.apache.camel.main.MainSupport.run(MainSupport.java:77)
[1]     at org.apache.camel.k.main.ApplicationRuntime.run(ApplicationRuntime.java:76)
[1]     at org.apache.camel.k.main.Application.main(Application.java:42)
[1] 2020-03-15 21:38:05.926 INFO  [Camel Thread #0 - CamelHangupInterceptor] MainSupport$HangupInterceptor - Received hang up - stopping the main instance.
@lmorandini lmorandini changed the title 'context' object not available in JavaScrpt integrations 'context' object not available in JavaScript integrations Mar 16, 2020
@nicolaferraro nicolaferraro added this to the 1.0.0 milestone Mar 16, 2020
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