Skip to main content

1. Create the Integration

An integration is an Apache Camel route that the platform builds and runs for you. In inline mode you type the route in the console: there is no repository, no build file and no image to prepare.

Integration creation form​

Open Runtime Manager, go to Integrations, then Create Integration.

  1. Name it orders-api and describe what it does.
  2. Integration group: choose None — create it on its own. On its own, the integration is deployed and versioned by itself. In a group, it is deployed and versioned with the other integrations of the group; a group suits integrations that are always released together.
  3. Source mode: keep Inline.

Writing the route in the YAML, Java or XML DSL​

In Sources, choose the language of the file and type the route. The three versions below do exactly the same thing: use the one you are most at ease with. The rest of the tutorial uses YAML.

orders.camel.yaml
- route:
id: orders
from:
uri: platform-http:/orders
parameters:
httpMethodRestrict: GET
steps:
- setHeader:
name: Content-Type
constant: application/json
- setBody:
constant: '{"service":"orders","status":"ok"}'

What it says:

  • platform-http:/orders: listen for HTTP requests on the path /orders;
  • httpMethodRestrict: GET: only answer GET;
  • the two steps set the content type and the body of the answer.

One integration can hold several source files, each in its own language.

One route per concern

Several short routes with clear ids are easier to read in traces and metrics than one long route: every series and every span is labelled with the route ID.

Camel and Maven dependencies​

Dependencies lists the Camel components and libraries the integration needs.

  • The components your route uses in its addresses (here platform-http) are found and added for you.
  • Three monitoring dependencies are already there and cannot be removed: they are what makes logs, metrics and traces work.
  • Add one yourself when a route needs something that does not appear in an address, such as a data format: camel:jackson for a Camel component, mvn:group:artifact:version for a Maven library.

Repositories takes the addresses of extra Maven repositories, when a library is not in the ones the environment already knows.

HTTP service (Expose HTTP Endpoint)​

Leave Expose HTTP Endpoint on. It gives the integration a service inside the environment, so that other integrations (and later the gateway) can call it. Turn it off for an integration that only consumes, such as one reading a queue or running on a timer.

Reachable inside the environment only

At this stage the integration has no address on the internet. Publishing it is step 8.

Create the integration. It now exists, but nothing runs yet: deploy it.

Resulting resources​

What exists so far
Runtime Manager
└── orders-api an integration on its own, inline, one YAML route