= Writing Integrations in JavaScript

[WARNING]
====
The JavaScript DSL is current in preview support level.
====

An integration written in JavaScript looks very similar to a Java one:

[source,js]
.hello.js
----
function proc(e) {
    e.getIn().setBody('Hello Camel K!')
}

from('timer:tick')
    .process(proc)
    .to('log:info')
----

To run it, you need just to execute:

```
kamel run hello.js
```

For JavaScript integrations, Camel K does not yet provide an enhanced DSL, but you can access to some global bounded objects such as a writable registry and the camel context so to set the property _exchangeFormatter_ of the _LogComponent_ as done in previous example, you can do something like:

[source,js]
----

l = context.getComponent('log', true, false)
l.exchangeFormatter = function(e) {
    return "log - body=" + e.in.body + ", headers=" + e.in.headers
}
----

