You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2022/11/12 08:53:00 UTC

[jira] [Created] (CAMEL-18718) camel-javascript - Language based on graalvm sdk

Claus Ibsen created CAMEL-18718:
-----------------------------------

             Summary: camel-javascript - Language based on graalvm sdk
                 Key: CAMEL-18718
                 URL: https://issues.apache.org/jira/browse/CAMEL-18718
             Project: Camel
          Issue Type: New Feature
            Reporter: Claus Ibsen
             Fix For: 3.x


Lets see if we can use graalvm-sdk or graalvm-js that can compile and execute javascript code (with npm modules imported)

A dirty prototype

{code}
public static void main(String[] args) throws IOException {

        String src = "import {faker} from '../js/node_modules/@faker-js/faker/dist/esm/index.mjs';" +
                     "const randomName = faker.name.fullName();" +
                     "console.log(randomName);";
    
        Context cx = Context.newBuilder("js")
                    .allowIO(true)
                    .build();
    
        cx.eval(Source.newBuilder("js", src, "test.mjs").build());
    }
{code}

If we can then make this as a language in Camel then end users can more easily use this together with Camel.





--
This message was sent by Atlassian Jira
(v8.20.10#820010)