Skip to content

Latest commit

 

History

History
96 lines (50 loc) · 4.19 KB

README.md

File metadata and controls

96 lines (50 loc) · 4.19 KB

Apache Camel F2F tooling hackathon (go back)

Lab 1: Create a Camel Route

The goal of this lab is to create a simple Camel route in VS Code leveraging the Extension pack for Apache Camel by Red Hat.

Prerequisites

Instructions

  1. Open the command palette by pressing F1 or Ctrl + Shift + P (Windows/Linux) or Cmd + Shift + P (Mac).

  2. Type Camel: Create a Camel Route using YAML DSL and press Enter.

Command palette

  1. Type test to be the file name and press Enter.

New route

  1. The new file will be opened with the Kaoto editor.

Kaoto editor

  1. Execute the route by pressing the Run button in the top right corner of the editor.

Run

  1. The route will be executed and the output will be shown in the terminal.

Running a route

  1. In the route, click on the setBody component to open the configuration panel

Configuring setBody

  1. By default, only Required properties are shown. Click on the All button to show all properties.

All properties

  1. Change the expression property to Hello from the tooling hackathon!.

Update expression

  1. Save the file by pressing Ctrl + S (Windows/Linux) or Cmd + S (Mac) and notice how the route is restarted automatically.

Route restart

  1. Let's replace the log EIP (Enterprise Integration Pattern) with a log component. Right-click on the log EIP, and select Replace in the context menu.

Context menu

  1. Write log in the search box and select the Log Data component.

Select log component

  1. Save the file by pressing Ctrl + S (Windows/Linux) or Cmd + S (Mac) and notice how the route is restarted and now it shows the Exchange information.

Showing exchange info

  1. Let's configure the Log component to show the Exchange headers and pretty print the information. Click on the Log component to open the configuration panel. In the search box, type header and enable the showHeaders property.

Enable show headers

  1. Save the file by pressing Ctrl + S (Windows/Linux) or Cmd + S (Mac) and notice how the route is restarted and now it shows the empty Exchange headers map.

Empty headers

  1. Let's add a header to the Exchange. Right-click on the log component to open the context menu and select Prepend to add a new EIP before the log component.

Prepend

  1. Write setHeader in the search box and select the SetHeader EIP.

Add setHeader

  1. Notice how the SetHeader EIP is added before the Log component and it shows a yellow warning indicating that required properties are missing. Click on the SetHeader EIP to open the configuration panel.

Missing required properties

  1. Click on All, then in the Expression field, type ${messageHistory}. Note that the list of available variables depends on the chosen language, in this case with Simple expression you can look at Camel documentation for Simple language.

Expression field

  1. In the Name field, type messageHistory.

Name field

  1. Save the file by pressing Ctrl + S (Windows/Linux) or Cmd + S (Mac) and notice how the route is restarted and now it shows the Exchange headers map with the messageHistory header.

Headers map

  1. Congratulations! You have developed a simple Camel route in VS Code.