Professional Documents
Culture Documents
Tutorials
Version 7.1
December 2012
Integration Everywhere
Tutorials
Version 7.1
Updated: 15 Jan 2014
Copyright 2012 Red Hat, Inc. and/or its affiliates.
Trademark Disclaimer
These materials and all Progress software products are copyrighted and all rights are reserved by Progress Software Corporation.
The information in these materials is subject to change without notice, and Progress Software Corporation assumes no responsibility
for any errors that may appear therein. The references in these materials to specific platforms supported are subject to change.
Fuse, FuseSource, Fuse ESB, Fuse ESB Enterprise, Fuse MQ Enterprise, Fuse Mediation Router, Fuse Message Broker, Fuse
Services Framework, Fuse IDE, Fuse HQ, Fuse Management Console, and Integration Everywhere are trademarks or registered
trademarks of FuseSource Corp. or its parent corporation, Progress Software Corporation, or one of their subsidiaries or affiliates
in the United States. Apache, ServiceMix, Camel, CXF, and ActiveMQ are trademarks of Apache Software Foundation. Any other
names contained herein may be trademarks of their respective owners.
Table of Contents
1.
2.
3.
4.
5.
6.
7.
11
21
25
31
39
45
51
List of Figures
1.1. New Fuse IDE Project project location page .............................................................................
1.2. New Fuse IDE Project details page ........................................................................................
1.3. Generated project files .......................................................................................................
1.4. Camel XML file wizard .......................................................................................................
1.5. New camelContext file in the route editor's source view ..............................................................
1.6. Endpoint property editor .....................................................................................................
1.7. Completed route, diagram view ............................................................................................
3.1. When property editor ........................................................................................................
3.2. Completed content-based router with logs ..............................................................................
4.1. Fuse Integration perspective ................................................................................................
4.2. Route elements in JMX Explorer ...........................................................................................
4.3. Message files in simple-route project .....................................................................................
4.4. Fuse Integration perspective's message tracing components .........................................................
5.1. New Camel JUnit Test wizard ..............................................................................................
5.2. Test endpoints page ..........................................................................................................
5.3. JUnit view ......................................................................................................................
6.1. Fuse ESB Enterprise server configuration ................................................................................
6.2. Fuse ESB console .............................................................................................................
7.1. Creating a fabric and listing its containers ...............................................................................
7.2. Fabric Details wizard .........................................................................................................
7.3. simple-route bundle deployed ..............................................................................................
12
13
14
15
17
18
18
26
28
32
33
34
36
40
42
43
46
47
52
52
54
List of Examples
1.1. XML for simple route ......................................................................................................... 19
2.1. Contents of message1.xml .................................................................................................. 22
3.1. XML for content-based router .............................................................................................. 28
10
On the Toolbar, select File New Fuse Project to open the New
Fuse IDE Project wizard, as shown in Figure 1.1 on page 12.
11
2.
12
Click Next> to open the New Fuse IDE Project details page, as shown
in Figure 1.2 on page 13.
3.
Select camel-archetype-spring.
4.
5.
6.
13
7.
8.
Click Finish.
This procedure creates a Fuse IDE project, simple-route, in Package
Explorer that contains everything needed to create and run routes. As
shown in Figure 1.3, the files generated for simple-route include:
simple-route/pom.xml (Maven project file)
simple-route/src/main/resources/META-INF/spring/camel-context.xml
(Spring XML file containing the routing rules)
14
1.
2.
3.
4.
5.
6.
Select New Camel XML File to open the Camel XML File wizard, as
shown in Figure 1.4.
15
7.
button.
Tip
The
button opens a dialog that displays the folders
of all active projects, which you can browse to find and select
the files you need.
8.
9.
Check that Spring appears in the Framework field, or select it from the
field's drop-down list.
Tip
Fuse IDE opens in Java perspective, with Outline view located
in the upper, right corner of the workspace. To provide more
room for Design view to display the graphical representation of
your route, click-drag Outline view to the lower, left corner of
the workspace, below Package Explorer, and release it. Your
workspace will look similar to Figure 1.5 on page 17, but with
Design view open on the canvas.
11. Click the Source tab at the bottom, left of the canvas to open the new
camelContext.xml file in the route editor's Source view, as shown in
Figure 1.5 on page 17.
16
Figure 1.5. New camelContext file in the route editor's source view
12. Click the Design tab at the bottom, left of the canvas to return to the
route editor's Design view.
13.
14. Drag a second Endpoint element from the Pallet to the canvas.
15. Select the first endpoint you dragged onto the canvas.
The Properties editor, located below the canvas, displays the endpoint's
property fields for editing, as shown in Figure 1.6 on page 18.
17
16. Enter file:src/data?noop=true in the Uri field. Leave the other fields
blank.
17. Select the second endpoint you dragged onto the canvas.
18. Enter file:target/messages/others in the Uri field. Leave the other
fields blank.
19. On the canvas, select the first endpoint (file:src/data?noop=true),
and click-drag it's connector arrow ( ) to the second endpoint
(file:target/messages/others), then release it.
A segmented line connects the two endpoints, as shown in Figure 1.7.
Figure 1.7. Completed route, diagram view
Tip
You can click-drag the line's bendpoint (orange dot) to change
the angle of the line's segments. Doing so creates two new
bendpoints, one on either side of the original. This behavior
enables you to easily adjust your diagram to accommodate
increasingly complex routes.
18
20. To quickly align the connected endpoints, right-click the canvas to open
the context menu, and then select Layout Diagram.
21. Select File Save to save the route.
22. Click the Source tab at bottom, left of the canvas.
The Source view displays the XML for the route. The camelContext
element will look like Example 1.1.
Example 1.1. XML for simple route
<camelContext xmlns="http://camel.apache.org/schema/spring" trace="false">
<route>
<from uri="file:src/data?noop=true"/>
<to uri="file:target/messages/others"/>
</route>
</camelContext>
Next steps
After you have created and designed your route, you can run it by deploying
it into your Apache Camel runtime, as described in "Running a Route"
on page 21.
Further reading
19
20
Prerequisites
Open the simple-route project you created in "Creating the Fuse IDE
project" on page 11.
2.
.
3.
[pache.camel.spring.Main.main()] MainSupport
INFO Apache Camel 2.8.0-fuse-00-05 starting
[pache.camel.spring.Main.main()] CamelNamespaceHandler INFO OSGi environment not detected.
[pache.camel.spring.Main.main()] SpringCamelContext
INFO Apache Camel 2.8.0-fuse-00-05 (CamelCon
text: camel-1) is starting
[pache.camel.spring.Main.main()] SpringCamelContext INFO JMX enabled. Using ManagedManagementStrategy.
[pache.camel.spring.Main.main()] AnnotationTypeConverterLoader INFO Found 3 packages with 14 @Con
verter classes to load
[pache.camel.spring.Main.main()] DefaultTypeConverter
INFO Loaded 162 core type converters (total
162 type converters)
[pache.camel.spring.Main.main()] DefaultTypeConverter
INFO Loaded additional 0 type converters
21
INFO
INFO
INFO
To shutdown the route, click the red square ( ) located at the top, right
of the Console panel.
2.
3.
4.
5.
22
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<person user="james">
<firstName>James</firstName>
<lastName>Strachan</lastName>
<city>London</city>
</person>
Further reading
http://fusesource.com/docs/router
23
24
Prerequisites
To complete this tutorial you will need the simple-route project you created
in "Creating a New Route" on page 11.
Procedure
3.
Tip
Alternatively, you can delete the connector by selecting it, then
selecting Delete from the toolbar's Edit menu.
4.
25
5.
6.
7.
On the canvas, select the choice node, then right-click it to open the
context menu.
8.
9.
26
An otherwise node (
node.
Tip
In Fuse Integration perspective's Messages View, Fuse IDE
inserts the contents of the log node's Message field in the Trace
Node Id column for message instances, when tracing is enabled
on the route (see Figure 4.4 on page 36). In the Console, it
adds the contents to the log data whenever the route runs.
17. On the canvas, select the otherwise node, and then right-click it to open
the context menu.
18. Select Add Endpoints Log
A log node ( ) appears on the canvas, connected to the otherwise
node. The Properties editor opens, displaying the log node's property
fields for you to edit.
19. In the Message field, enter other messages, and in the Log Name field,
enter 2.
20. On the canvas, select the log 1 node, and then right-click it to open the
context menu.
21. Select Add Endpoints Endpoint
27
24. To quickly realign all of the nodes on the canvas, right-click the canvas
to open the context menu, and then select Layout Diagram.
The route on the canvas should resemble Figure 3.2.
Figure 3.2. Completed content-based router with logs
25. On the toolbar, select File Save to save the completed route.
26. Click the Source tab at the bottom, left of the canvas to display the XML
for the route.
The camelContext element will look like that shown in Example 3.1.
Example 3.1. XML for content-based router
<camelContext xmlns="http://camel.apache.org/schema/spring" trace="false">
<route>
28
<from uri="file:src/data?noop=true"/>
<choice>
<when id="when1">
<xpath>/person/city='London'</xpath>
<log logName="1" message="uk messages" />
<to uri="fille:target/messages/uk" />
</when>
<otherwise>
<log logName="2" message="other messages" />
<to uri="file:target/messages/others" />
</otherwise>
</choice>
</route>
</camelContext>
Next steps
You can run the new route as described in "Running the route" on page 21.
Further reading
http://fusesource.com/docs/router
29
30
Prerequisites
To complete this tutorial you will need the simple-route project you updated
in "Adding a Content-Based Router" on page 25.
Procedure
31
Tip
You can use the Open Perspective icon ( ) in the perspectives
tab to access the list of available perspectives.
2.
32
3.
4.
5.
Double click Local Camel Context [id] to expand the elements of your
route as shown in Figure 4.2 on page 33).
6.
In JMX Explorer, select Start Tracing from the camel-1's context menu.
Fuse IDE displays a graphical representation of your route in Diagram
View.
7.
In Diagram View, drag the nodes to rearrange them, so you can clearly
see the route's flow paths.
Tip
You will have to rearrange the nodes in Diagram View each time
you select a different node in JMX Explorer.
33
8.
9.
As the message traverses the route, Fuse IDE traces and records its
passage at each step and displays the results in Messages View.
10. Repeat Step 9.
11. Drag message2.xml drop it on
.../camel-1/Endpoints/file/src/data?noop=true.
34
As shown in Figure 4.4 on page 36, Fuse IDE draws the route in
Diagram View, tagging paths exiting a processing step with timing and
performance metrics. Only the metric Total exchanges is displayed in
the diagram. Hovering over the displayed metrics reveals additional
metrics about message flow:
mean time the step took to process a message
maximum time the step took to process a message
minimum time the step took to process a message
35
36
Fuse IDE displays the details about a message instance in the top half
of the Properties panel and the contents of the message instance,
including any headers, in the bottom half of the Properties panel. So, if
your application sets headers at any step within a route, you can check
whether they are set as expected.
Tip
You can control columnar layout in all Fuse IDE tables. Drag a
column's border rule to expand or contract its width. To hide a
column, totally contract its borders. You can rearrange table
layout by reordering its columns. To do so, drag a column header
to where you want it to appear in the table.
16. When done, switch back to the Console and click the stop button ( )
in the upper, right side of its pane.
Next steps
You can run the route with a JUnit test case, as described in "Testing a Route
with JUnit" on page 39.
Further reading
http://fusesource.com/docs/router
37
38
Prerequisites
2.
Right-click it to open the context menu, and then select New Camel
Test Case to open the New Camel JUnit Test Case wizard, as shown in
Figure 5.1 on page 40.
39
3.
Tip
If needed, you can click
4.
40
5.
Tip
The Name field defaults to CamelContextXmlTest for the name
of the test file.
6.
41
7.
By default, all endpoints are selected and will be included in the test
case. You can select or deselect all endpoints by clicking the Select All
or Deselect All button, or you can select and deselect individual endpoints
by clicking the check box next to each.
8.
Click Finish.
Tip
If prompted, add JUnit to the build path.
42
The artifacts for the test are added to your project, and the class implementing
the test case is opened in the Java editor.
Running the test
2.
3.
4.
Further reading
Examine the output and take action to resolve any test failures.
43
44
Prerequisites
In Fuse Integration perspective, click the Servers tab in the lower, right
pane to open the Servers view.
2.
Click new server wizard to open the Define a New Server page.
3.
If necessary, expand the Red Hat node to expose the available server
options.
4.
45
5.
Accept the defaults for Server's host name (localhost) and Server
name (Fuse ESB Enterprise 7.x server at localhost), and then
click Next to open the Fuse ESB Enterprise Runtime page.
6.
In Installation directory, enter the path where the Fuse ESB Enterprise
7.x installation is located, or click the Browse to search for it, and then
click Next to open the Fuse ESB Enterprise page.
7.
Accept the defaults for Host Name (0.0.0.0) and Port Number (8101).
8.
Note
If the default (smx) has been changed for either property, use
the new setting.
9.
46
Wait a few seconds for Fuse ESB Enterprise 7.x server to start up. When
it does, Fuse ESB [xxx] appears in JMX Explorer under the local
processes node.
Important
If the warning that the remote host identification has changed
appears, click yes to delete the old key and insert the new key
only if the Fuse ESB Enterprise 7.x server runtime is installed
on the same machine where Fuse IDE is running! Otherwise
click no and contact your system administrator.
When Fuse ESB Enterprise 7.x server starts up, the Fuse ESB console
starts up in Shell view, as shown in Figure 6.2:
Figure 6.2. Fuse ESB console
11. In JMX Explorer, right-click Fuse ESB [xxx] to open the context menu,
and then click Connect.
Now you're ready to deploy your project.
From Project Explorer, drag the simple-route root project over to JMX
Explorer and drop it on Fuse ESB [xxx].
47
Tip
The Deploy to... tool provides an alternative to the drag and
drop method of deployment. For details, see "Deploying a
Project to a JMX Connected Container" in Users Guide.
Console view chronicles the process as Fuse IDE builds the
simple-route project, runs the tests, and then installs the project as
a bundle inside Fuse ESB [xxx].
2.
In JMX Explorer, right-click Fuse ESB [xxx] to open the context menu,
and then click Refresh.
Tip
You may have to repeat the Refresh operation a few times before
your project appears in JMX Explorer under Fuse ESB [xxx}
Camel as <bundleIdentifier>-camel-#. (Camel generates and
appends an ID number to the end of the node name to ensure
that every camel context is uniquely identified.)
In the mean time, you can verify whether your project's bundle
was installed by clicking the Bundles node under Fuse ESB
[xxx] to display, in Properties view, all installed bundles. Start
typing tutorial in Properties view's Search tool to quickly
determine whether your project's tutorial.simple-route
bundle is included in the list.
Once your project appears in JMX Explorer, you can start tracing on it,
as described in "Tracing a Message Through a Route" on page 31.
2.
Further reading
48
49
50
Prerequisites
2.
Wait a few seconds for the Fuse ESB Enterprise 7.x server to start up,
and then switch to the Fuse ESB console in Shell view.
3.
At the Fuse ESB console command line, enter fabric:create and press
Enter to create a Fuse Fabric.
51
4.
5.
6.
Note
If the defaults for user name and password have been changed,
use the new settings.
7.
52
Press OK.
In Fabric Explorer, right-click Local Fabric to open the context menu, and
then click Connect to connect to the new fabric.
Now you're ready to create a new fabric profile into which you'll deploy your
camel project.
2.
Further expand the profiles tree to find the camel profile nested under
the karaf profile.
3.
Right-click the camel profile to open the context menu, and then click
Create a new Profile.
4.
5.
Click the myCamelRoute profile to populate the Profiles page with its
information.
6.
In the Parents pane, you can see that the camel profile is the new
profile's immediate parent. Leave camel selected.
Now you're ready to deploy your camel project to the profile
myCamelRoute.
53
Tip
The Deploy to... tool provides an alternative to the drag and
drop method of deployment. For details, see "Deploying a
Project to a Fabric Container" in Users Guide.
Console view chronicles the process as Fuse IDE builds the
simple-route project, runs the tests, installs the project as a bundle
in the myCamelRoute profile, and then uploads the profile to the fabric's
internal Maven repository.
2.
3.
On the Profiles page, check that the simple-route bundle appears in the
Fabs field, as shown in Figure 7.3 on page 54.
Now you can deploy your camel project to the fabric by creating one or
more containers on the fabric and assigning the myCamelRoute profile
to them. Once the containers are started, you can start tracing on the
deployed projects, as described in "Tracing a Message Through a Route"
54
on page 31, but selecting the route in Fabric Explorer instead of JMX
Explorer.
Further reading
55
56