My 1st Camel ride

Christina Lin

Open up your JBDS, create a new Fuse Project.

Use the camel-blueprint archetype, and name your own group id and artifact id. 

example

Click on Finish, You will see the project has now been created.

Open up /example/src/main/resources/OSGI-INF/blueprint/blueprint.xml and remove the demo route, so you are left with a blank canvas. 

Remove the bean setting in the blueprint.xml

Remove default java bean, by deleting the pre-generated java files

  • src/main/java/*
  • src/test/java/*

Create the following route, by dragging the component from

palette to canvas.

All the configurations 

are under properties

view.  

  • File Endpoint
    • Directory Name: myxml
    • Delete : true  
  • Log Endpoint
    • Message: ${in.header.CamelFileName} with content -> ${body}

 

  • SetHeader (Under Transformation in palette)
    • headerName: CamelFileName
    • language: simple
    • expression: ${date:now:yyyyMMddhhmmss}-read.xml             

 

  • File Endpoint
    • Directory Name: donexml                                                                

Create 2 directory in your project, and place the xml files into myxml folder. (create a new xml or see file in appendix at the end)

  • myxml

  • donexml

Run test, file should be generated in the donexml folder.

Right click on camel file, choose Debug AS, click on Local Camel Context (without tests) to start debugging

Let's try the debugging mode, this time, on log component, set a breakpoint by click on the red dot...

Kick off the route by placing another xml file into myxml folder, It will take you to the debugging view, 

Click on the arrow to continue on to next breakpoint or the rest of the route. 

APPENDIX - order01.xml

<?xml version="1.0" encoding="UTF-8"?>
<!-- Red Hat Stock Exchange and Trading Systems-->
<stocktrading>
    <name>Christina Lin</name>
    <custId>A123456789</custId>
    <vip>1</vip>
    <stockId>XYZ</stockId>
    <shares>11</shares>        
</stocktrading>

APPENDIX - order02.xml

<?xml version="1.0" encoding="UTF-8"?>
<!-- Red Hat Stock Exchange and Trading Systems-->
<stocktrading>
    <name>Frank Jarrod</name>
    <custId>F475678678</custId>
    <vip>4</vip>
    <stockId>ABC</stockId>
    <shares>20</shares>        
</stocktrading>

1st Camel Ride completed!

My 1st Camel Ride

By weimeilin

My 1st Camel Ride

  • 17,746