Sei sulla pagina 1di 42

Fuse ESB

Product Introduction
Version 4.4.1
Sept. 2011
Product Introduction
Version 4.4.1
Updated: 30 Nov 2011
Copyright 2011 FuseSource Corporation, a Progress Software company. All rights reserved.
Legal Notices
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.
Actional, Apama, Apama (and Design), Artix, Business Empowerment, DataDirect (and design), DataDirect Connect, DataDirect
Connect64, DataDirect Technologies, DataDirect XML Converters, DataDirect XQuery, DataXtend, Dynamic Routing Architecture,
EdgeXtend, Empowerment Center, Fathom, FUSE Mediation Router, FUSE Message Broker, FUSE Services Framework,
IntelliStream, IONA, Making Software Work Together, Mindreef, ObjectStore, OpenEdge, Orbix, PeerDirect, POSSENET, Powered
by Progress, PowerTier, Progress, Progress DataXtend, Progress Dynamics, Progress Business Empowerment, Progress
Empowerment Center, Progress Empowerment Program, Progress OpenEdge, Progress Profiles, Progress Results, Progress
Software Developers Network, Progress Sonic, ProVision, PS Select, Savvion, SequeLink, Shadow, SOAPscope, SOAPStation,
Sonic, Sonic ESB, SonicMQ, Sonic Orchestration Server, SonicSynergy, SpeedScript, Stylus Studio, Technical Empowerment,
WebSpeed, Xcalia (and design), and Your Software, Our TechnologyExperience the Connection are registered trademarks of
Progress Software Corporation or one of its affiliates or subsidiaries in the U.S. and/or other countries. AccelEvent, Apama
Dashboard Studio, Apama Event Manager, Apama Event Modeler, Apama Event Store, Apama Risk Firewall, AppsAlive, AppServer,
ASPen, ASP-in-a-Box, BusinessEdge, Business Making Progress, Cache-Forward, DataDirect Spy, DataDirect SupportLink, FUSE,
FuseSource, Future Proof, GVAC, High Performance Integration, ObjectStore Inspector, ObjectStore Performance Expert, OpenAccess,
Orbacus, Pantero, POSSE, ProDataSet, Progress Control Tower, Progress ESP Event Manager, Progress ESP Event Modeler,
Progress Event Engine, Progress RFID, Progress RPM, Progress Software Business Making Progress, PSE Pro, SectorAlliance,
SeeThinkAct, Shadow z/Services, Shadow z/Direct, Shadow z/Events, Shadow z/Presentation, Shadow Studio, SmartBrowser,
SmartComponent, SmartDataBrowser, SmartDataObjects, SmartDataView, SmartDialog, SmartFolder, SmartFrame, SmartObjects,
SmartPanel, SmartQuery, SmartViewer, SmartWindow, Sonic Business Integration Suite, Sonic Process Manager, Sonic Collaboration
Server, Sonic Continuous Availability Architecture, Sonic Database Service, Sonic Workbench, Sonic XML Server, The Brains
Behind BAM, WebClient, and Who Makes Progress are trademarks or service marks of Progress Software Corporation and/or its
subsidiaries or affiliates in the U.S. and other countries. Java and all Java-based marks are trademarks or registered trademarks
of Sun Microsystems, Inc. in the U.S. and other countries. Any other trademarks contained herein are the property of their
respective owners.
Third Party Acknowledgments
Fuse ESB v4.3.1 incorporates ASM v3.1 from INRIA, France Telecom. Such technology is subject to the following terms and
conditions: ASM: a very small and fast Java bytecode manipulation framework Copyright (c) 2000-2005 INRIA, France Telecom
All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that
the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of
the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software
without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Fuse ESB v4.3.1 incorporates HSQL Database Engine v1.7.3.3 from Hypersonic SQL Group. Such technology is subject to the
following terms and conditions: Hypersonic SQL License Copyright Copyright (c) 1995-2000 by the Hypersonic SQL Group. All
rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and
the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other materials provided with the distribution. All advertising materials mentioning
features or use of this software must display the following acknowledgment: "This product includes Hypersonic SQL." Products
derived from this software may not be called "Hypersonic SQL" nor may "Hypersonic SQL" appear in their names without prior
written permission of the Hypersonic SQL Group. Redistributions of any form whatsoever must retain the following acknowledgment:
"This product includes Hypersonic SQL." This software is provided "as is" and any expressed or implied warranties, including, but
not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the
Hypersonic SQL Group or its contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages
(including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption).
However caused any on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise)
arising in any way out of the use of this software, even if advised of the possibility of such damage. This software consists of
voluntary contributions made by many individuals on behalf of the Hypersonic SQL Group.
Fuse ESB v4.3.1 incorporates JBoss.org Javassist v3.9.0.GA, The contents of these files are subject to the Mozilla Public
License Version 1.1 (the "License") provided below; you may not use this file except in compliance with the License. You may
also obtain a copy of the License at http://www.mozilla.org/MPL/. Software distributed under the License is distributed on an
"AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing
rights and limitations under the License. For Javassist v3.9.0.GA, The Original Code is Javassist. The Initial Developer of the
Original Code is Shigeru Chiba. Portions created by the Initial Developer are Copyright (C) 1999-2008 Shigeru Chiba. All Rights
Reserved.
Fuse ESB v4.3.1 incorporates ANTLR, Another Tool for Language Recognition v2.7.7 from Terrence Parr. Such technology is
subject to the following terms and conditions: SOFTWARE RIGHTS ANTLR 1989-2006 Developed by Terence Parr Partially
supported by University of San Francisco & jGuru.com. We reserve no legal rights to the ANTLR--it is fully in the public domain.
An individual or company may do whatever they wish with source code distributed with ANTLR or the code generated by ANTLR,
including the incorporation of ANTLR, or its output, into commercial software. We encourage users to develop software with
ANTLR. However, we do ask that credit is given to us for developing ANTLR. By "credit", we mean that if you use ANTLR or
incorporate any source code into one of your programs (commercial product, research project, or otherwise) that you acknowledge
this fact somewhere in the documentation, research report, etc... If you like ANTLR and have developed a nice tool with the
output, please mention that you developed it using ANTLR. In addition, we ask that the headers remain intact in our source code.
As long as these guidelines are kept, we expect to continue enhancing this system and expect to make other tools available as
they are completed. The primary ANTLR guy: Terence Parr <parrt@cs.usfca.edu> <parrt@antlr.org>.
Table of Contents
1. Introducing Fuse ESB ........................................................................................................... 9
2. The Fuse ESB Architecture .................................................................................................. 13
Architecture Overview ..................................................................................................... 14
The Kernel ................................................................................................................... 15
Supported Technologies ................................................................................................... 17
The Console ................................................................................................................. 18
3. Fuse ESB Basics ............................................................................................................... 19
Fuse ESB Directory Structure ............................................................................................ 20
Starting and Stopping Fuse ESB ........................................................................................ 22
Using the Console .......................................................................................................... 23
Running the Examples .................................................................................................... 25
Using the Web Console ................................................................................................... 28
4. Deploying a Web Service into Fuse ESB .................................................................................. 31
Deploying the Example .................................................................................................... 32
Running a client ............................................................................................................ 34
Understanding the Example .............................................................................................. 36
Index .................................................................................................................................. 41
5 Fuse ESB Product Introduction Version 4.4.1
List of Figures
2.1. The Fuse ESB Architecture .................................................................................................. 14
3.1. Available Console Commands .............................................................................................. 23
3.2. Available shell Commands .................................................................................................. 23
3.3. Help for the features:list Command ...................................................................................... 24
3.4. The Web Console ............................................................................................................. 29
4.1. Example Client HTML Screen .............................................................................................. 34
Fuse ESB Product Introduction Version 4.4.1 6
List of Examples
4.1. CXF OSGi Example WSDL .................................................................................................. 32
4.2. POM Elements for Using Fuse ESB OSGi Tooling ...................................................................... 36
4.3. OSGi Example Spring Configuration ....................................................................................... 37
4.4. OSGi POM ...................................................................................................................... 38
7 Fuse ESB Product Introduction Version 4.4.1
Fuse ESB Product Introduction Version 4.4.1 8
Chapter 1. Introducing Fuse ESB
Fuse ESB is an open, standards based integration platform. It reduces the complexity of integrating disparate
applications by leveraging the service oriented architecture principles and standardized packaging frameworks.
Overview One of the biggest challenges facing modern enterprises is IT system
integration. Fuse ESB tackles this problem using a lightweight standards
based, loosely coupled approach. By relying on standards, Fuse ESB reduces
the chances of vendor lock-in. By advocating loose coupling, Fuse ESB reduces
the complexity of integration.
Integration problems Enterprise networks commonly deploy disparate applications, platforms, and
business processes that need to communicate or exchange data with each
other. The applications, platforms and processes have non-compatible data
formats and non-compatible communications protocols. If an enterprise needs
to interface with external systems, the integration problem extends outside
of a company and encompasses its business partners' IT systems and
processes as well.
In recent years, there have been several technologies attempting to solve
these problems such as Enterprise Application Integration (EAI) and
Business-to-Business (B2B). These solutions addressed some of the integration
problems, but were proprietary, expensive, and time-consuming to implement.
These solutions range from expensive vendor solutions (high cost, vendor
lock-in) to home-grown custom solutions (high maintenance, high cost). The
overwhelming disadvantages of these solutions are high cost and low flexibility
due to non-standard implementations.
Most recently, Service Oriented Architecture (SOA) has become the hot
integration methodology. SOA attempts to address the shortcomings of the
other approaches by advocating the use of standards and the use of loosely
coupled interfaces. While, SOA, theoretically, improves the solution, it can
be difficult to implement because vendors are offering tools using proprietary
technologies and attempting to wrap old solutions in SOA clothing.
The ESB approach An enterprise service bus (ESB) is the back bone of a SOA implementation.
There is no canonical definition of an ESB. Wikipedia opens its entry on ESBs
(http://en.wikipedia.org/wiki/Enterprise_service_bus) by stating:
An ESB generally provides an abstraction layer on top of
an implementation of an enterprise messaging system,
9 Fuse ESB Product Introduction Version 4.4.1
which allows integration architects to exploit the value of
messaging without writing code. Contrary to the more
classical enterprise application integration (EAI) approach
of a monolithic stack in a hub and spoke architecture, the
foundation of an enterprise service bus is built of base
functions broken up into their constituent parts, with
distributed deployment where needed, working in harmony
as necessary.
Wikipedia
LooselyCoupled defines an ESB as follows:
An ESB acts as a shared messaging layer for connecting
applications and other services throughout an enterprise
computing infrastructure. It supplements its core
asynchronous messaging backbone with intelligent
transformation and routing to ensure messages are passed
reliably. Services participate in the ESB using either web
services messaging standards or the Java Message System
(JMS). Originally defined by analysts at Gartner, ESB is
increasingly seen as a core component in a service-oriented
infrastructure.
looselycoupled.com
The most common way of defining an ESB is by listing the services it provides.
These services include:
transport mediation - not all services that need to be integrated use HTTP
or JMS
dynamic message transformation - not all services are going to use SOAP
and are unlikely to require the same message structures
intelligent routing
security
An ESB simplifies the complexity of integration by providing a single, standards
based infrastructure into which applications can be plugged. Once plugged
into the ESB, an application or service has access to all of the infrastructure
services provided by the ESB and can access any other applications that are
also plugged into the ESB. For example, you could plug a billing system based
on JMS into an ESB and use the ESBs transport mediation features to expose
the billing system over the Web using SOAP/HTTP. You could also route
Fuse ESB Product Introduction Version 4.4.1 10
Chapter 1. Introducing Fuse ESB
internal POs directly into the billing system by plugging the your PO system
into the ESB.
Differentiating between ESB
implementations
Most ESB implementations provide all of the services that are used to define
an ESB, so it is hard to differentiate ESB implementations based on features.
A better way to differentiate between them is to use the following four
measures:
Supported deployment / runtime environments
Many ESB solutions are designed to be deployed into application servers,
other heavy weight containers, or proprietary runtime environments.
These types of ESB solution is ideal for distributed computing. They also
contribute to vendor lock-in.
Ideally, an ESB solution should have flexible deployment requirements
so that it can be distributed through out an enterprise.
Container/component model
Does the ESB solution use a standardized container model, such as J2EE,
JBI, or OSGi, for managing deployed services? Or does it use a proprietary
model?
Ideally, an ESB solution should use a standardized container model.
Standard models ensure maximum compatibility and lessen the learning
curve needed for adoption.
Coupling to other infrastructure components
ESB solutions often leave out infrastructure components like orchestration
engines and advanced transports like CORBA. Instead they rely on
plug-ins or other components to provided the functionality.
Many ESB solutions require a tight coupling between the ESB and the
added components. This means that you are limited to only using the
added components supplied by the ESB vendor or must learn complex
APIs to extend the ESB yourself.
Ideally, an ESB solution would provide a loose coupling or provide a
standardized interface between the ESB and any added components.
This allows the ESB to be extended easily and in a flexible manner.
Dependencies
ESB solutions have a lot of moving parts and complex dependencies.
Some ESB solutions handle these dependencies by locking themselves
into using proprietary solutions for things like security or JMS
11 Fuse ESB Product Introduction Version 4.4.1
implementations. Others rely on standardized implementations as much
as possible.
Ideally, an ESB solution would only depend on widely available
standardized libraries to make dependencies easy to manage.
The Fuse ESB approach Based on Apache ServiceMix, Fuse ESB reduces complexity and eliminates
vendor lock in because it is standards based and built using best in breed
open source technology. It differentiates itself in the following ways:
The Fuse ESB kernel is lightweight and can run on most platforms.
The Fuse ESB kernel uses the OSGi framework to simplify componentization
of applications.
The OSGi framework is a newly emerging standard for managing the
dependencies between application components. It also provides a standard
mechanism for controlling the life-cycle of components.
Fuse ESB supports the Java Business Integration (JBI) specification (JSR
208).
JBI is a well defined standard for packaging, deploying, and managing
components deployed to the ESB.
Fuse ESB can be coupled to other infrastructure services over a variety of
transport protocols and message formats.
Out of the box, the Fuse ESB supports JMS, HTTP, HTTPS, FTP, XMPP,
Web services, and a number of other bindings. In addition, you can easily
extend its connectivity options using other components that conform to
either the OSGi or JBI specification.
Fuse ESB employs standards as much as possible to limit dependencies.
In addition, Fuse ESB supports event driven architectures. Services deployed
into the Fuse ESB container can be fully decoupled and will simply listen on
the bus until an appropriate service request arrives. Fuse ESB also supports
events that occur outside of the bus. For example, a JMS service can listen
on a topic that is hosted outside of the bus and only act when an appropriate
message arrives.
Fuse ESB Product Introduction Version 4.4.1 12
Chapter 1. Introducing Fuse ESB
Chapter 2. The Fuse ESB Architecture
Fuse ESB employs a layered architecture that comprises a kernel, based on Apache Felix Karaf, and a technology
layer.
Architecture Overview ............................................................................................................. 14
The Kernel ........................................................................................................................... 15
Supported Technologies ........................................................................................................... 17
The Console ......................................................................................................................... 18
13 Fuse ESB Product Introduction Version 4.4.1
Architecture Overview
Fuse ESB employs a layered architecture comprised of the following:
Kernel
A lightweight runtime that extends OSGi with powerful features for
handling and managing OSGi bundles.
Technology layer
A layer of component technologies that sits on top of the kernel.
Figure 2.1. The Fuse ESB Architecture
Fuse ESB Product Introduction Version 4.4.1 14
Chapter 2. The Fuse ESB Architecture
The Kernel
The Fuse ESB kernel is based on Apache Karaf, an OSGi-based runtime that
provides a lightweight container into which you can deploy various components
and applications.
Features The kernel provides the following features:
Console
Karaf can be administered via an extensible console shell that supports
secure, remote access.
Dynamic logging
A dynamic logging backend provided by Log4J supports different APIs
(JDK 1.4, JCL, SLF4J, Avalon, Tomcat, OSGi).
Hot deployment
When a JAR file is added to the InstallDir/deploy folder, it is
automatically installed inside the runtime.
Provisioning
Application provisioning through file-drop, Maven repository and remote
download.
Dynamic configuration
Changes to the properties files contained in the InstallDir/etc directory
are monitored and propagated to the relevant services.
Security
Security framework based on Java Authentication and Authorization
Service (JAAS).
OSGi in a nutshell OSGi is set of open specifications aimed at making it easier to build and
deploy complex software applications. The key piece of OSGi technology is
the OSGi Framework. The framework manages the loading and management
of dynamic modules of functionality.
In an OSGi environment applications are packaged into bundles. A bundle is
a JAR that contains extra information about the classes and resources included
in the bundle. The information supplied in the bundle includes:
15 Fuse ESB Product Introduction Version 4.4.1
The Kernel
packages required by classes in the bundle
packages being exported by the bundle
version information for the bundle
Using the information in the bundle, the OSGi framework ensures that all of
the dependencies required by the bundle are present. If it is, the bundle is
activated and made available. The information in the bundle also allows the
framework to manage multiple versions of a bundle.
The OSGi specifications are maintained by the OSGi Alliance. See http://
www.osgi.org.
For more information about Fuse ESB's OSGi functionality see Deploying into
the OSGi Container.
Benefits of OSGi OSGi offers a number of benefits over other container and packaging models
including:
Hot deployment of artifacts
Management of multiple versions of a package, class, or bundle
Dynamic loading of code
Lightweight footprint
Multiple packaging options
Supported OSGi containers Karaf supports the following OSGi 4.2 containers:
Apache Felix Framework 2.0.0
Eclipse Equinox 3.5.
In Fuse ESB 4.4.1, the default container is Equinox. To change your OSGi
container, set the karaf.framework property to felix in the
etc/config.properties file.
Fuse ESB Product Introduction Version 4.4.1 16
Chapter 2. The Fuse ESB Architecture
Supported Technologies
The technology layer in Fuse ESB supports the following technologies:
JMS
Apache ActiveMQ message brokers can be deployed and managed as
OSGi bundles.
JAX-WS and JAX-RS
You can deploy JAX-WS and JAX-RS RESTful web services built using
Apache CXF.
Camel
You can implement enterprise integration patterns in Apache Camel and
deploy them in Fuse ESB
JBI
You can deploy Java Business Integration (JBI) 1.0 service assemblies
and service units in Fuse ESB. See Using Java Business Integration for
details.
Blueprint
Blueprint is a dependency-injection framework that is optimized for the
OSGi container. It enables you to define Camel routes, JMS endpoints,
Web service endpoints and OSGi services using XML syntax. It is similar
to the Spring framework, but is more lightweight.
Spring framework
You can add any Spring configuration file to the deploy directory and
Fuse ESB will generate an OSGi bundle on the fly and instantiate the
Spring application context.
17 Fuse ESB Product Introduction Version 4.4.1
Supported Technologies
The Console
Overview The Fuse ESB console is a shell environment, based on Apache Felix Gogo,
that enables you to control the Fuse ESB runtime. For details on the Gogo
shell, see http://felix.apache.org/site/apache-felix-gogo.html.
The Console Reference provides information about using the console and
includes descriptions of the available commands.
Features The Fuse ESB console provides the following features:
Extensible
You can expand the the functionality of the shell by writing custom
modules.
Artifact Management
One of the most important uses of the command console is managing
the artifacts deployed into the container. The command console provides
subshells to manage artifacts, including OSGi bundles, collections of
bundles, JBI artifacts, and OSGi bundle repositories (OBRs).
Remote Management
You will likely have many instances of the Fuse ESB runtime distributed
throughout your organization. To address this requirement, the command
console includes the commands ssh and sshd, which enable you to
connect to and start a remote secure shell server.
See "Using Remote and Child Instances of the Runtime" in Configuring
and Running Fuse ESB for more information about remote connections.
Fuse ESB Product Introduction Version 4.4.1 18
Chapter 2. The Fuse ESB Architecture
Chapter 3. Fuse ESB Basics
Once you have installed Fuse ESB, this chapter will help you get to know the basics of the product.
Fuse ESB Directory Structure .................................................................................................... 20
Starting and Stopping Fuse ESB ................................................................................................ 22
Using the Console .................................................................................................................. 23
Running the Examples ............................................................................................................ 25
Using the Web Console ........................................................................................................... 28
19 Fuse ESB Product Introduction Version 4.4.1
Fuse ESB Directory Structure
The directory layout of an installed Fuse ESB system is as follows:
/antcontains files related to the Ant tasks that Fuse ESB supports as
part of its compliance to the JBI specification
/binstartup scripts
/confinstall log
/datacached information and log files
/cachecached bundles loaded by the OSGi container at runtime
/generated-bundlesgenerated bundles created by the kernel. For
example, if you drop a non-OSGi enabled WAR file into the deploy
directory, an OSGi bundle will be generated here.
/loglog files
If you want to reset the runtime's environment to the default, you can just
delete the data directory. The next time Fuse ESB is started up it will create
a new data directory.
/deployhot deploy directory
/etckernel and bundle configuration files
/examplescontains example code that demonstrates the available
functionality in Fuse ESB
/instancescontains a directory for each child instance created using
the admin:create command. See "Managing Child instances" in Configuring
and Running Fuse ESB for details.
/libcontains the bootstrap libraries
/systemcontains the OSGi bundles to be installed at runtime, organized
as a Maven 2 repository. By default, Fuse ESB first checks this folder when
Fuse ESB Product Introduction Version 4.4.1 20
Chapter 3. Fuse ESB Basics
resolving a required artifact, before checking the user's local Maven
repository.
21 Fuse ESB Product Introduction Version 4.4.1
Fuse ESB Directory Structure
Starting and Stopping Fuse ESB
Starting To start Fuse ESB:
1. Make sure that the JAVA_HOME environment variable is set.
2. In a command prompt or terminal, change to the InstallDir/bin
directory.
3. Type:
Windows
servicemix.bat
*NIX
./servicemix
The ServiceMix logo and karaf> prompt appear in your terminal window:
____ _ __ __ _
/ ___| ___ _ ____ _(_) ___ ___| \/ (_)_ __
\___ \ / _ \ '__\ \ / / |/ __/ _ \ |\/| | \ \/ /
___) | __/ | \ V /| | (_| __/ | | | |> <
|____/ \___|_| \_/ |_|\___\___|_| |_|_/_/\_\
Apache ServiceMix (4.1.0-psc-01-00)
Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
karaf@root>
Stopping To stop Fuse ESB, do one of the following at the karaf> prompt:
Type osgi:shutdown or simply shutdown
Press Ctrl+D
Fuse ESB Product Introduction Version 4.4.1 22
Chapter 3. Fuse ESB Basics
Using the Console
Viewing available commands To see a list of the available commands in the console press the Tab key at
the karaf> prompt.
Figure 3.1. Available Console Commands
activemq:browse activemq:bstat activemq:create-
broker
activemq:destroy-broker activemq:list activemq:purge
activemq:query admin:change-port admin:connect
admin:create admin:destroy admin:list
admin:start admin:stop config:cancel
config:edit config:list config:propap
pend
config:propdel config:proplist config:propset
config:update dev:dynamic-import dev:framework
dev:show-tree features:addUrl features:install
features:list features:listUrl features:refre
shUrl
features:removeUrl features:uninstall jbi:list
jbi:shutdown jbi:start jbi:stop
log:display log:display-exception log:get
log:set nmr:list osgi:bundle-
level
osgi:headers osgi:install osgi:list
osgi:ls osgi:refresh osgi:resolve
osgi:restart osgi:shutdown osgi:start
osgi:start-level osgi:stop osgi:uninstall
osgi:update packages:exports packages:imports
shell:cat shell:clear shell:each
shell:echo shell:exec shell:grep
shell:if shell:info shell:java
shell:printf shell:sleep shell:sort
shell:tac ssh:ssh ssh:sshd
To see a list of commands in a particular command grouping, type the
command prefix, for example shell or osgi and then press Tab.
Figure 3.2. Available shell Commands
shell:cat shell:clear shell:each shell:echo
shell:exec
shell:grep shell:if shell:info shell:java
23 Fuse ESB Product Introduction Version 4.4.1
Using the Console
shell:printf
shell:sleep shell:sort shell:tac
Getting help on a command To view help on a particulare command, type the command followed by
--help. For example,
Figure 3.3. Help for the features:list Command
karaf@root> features:list --help
DESCRIPTION
features:list
Lists all existing features available from the defined repos
itories.
SYNTAX
features:list [options]
OPTIONS
--help
Display this help message
-i, --installed
Display a list of all installed features only
Fuse ESB Product Introduction Version 4.4.1 24
Chapter 3. Fuse ESB Basics
Running the Examples
Fuse ESB comes with a range of examples that demonstrates product's the
key functionality. These examples are stored in the InstallDir/examples
folder. Instructions for running and building each example are contained in
the readme file at the root of each example folder.
Before running the examples To run the examples you will need to do the following:
1. Make sure that you have Apache Maven 2.2.1 or later installed.
You can download Maven from http://maven.apache.org/.
2. Ensure that the M2_HOME environment variable is set to your Maven
installation directory.
3. Increase the amount of memory available to Maven by setting the
MAVEN_OPTIONS environment variable as follows:
UNIX
export MAVEN_OPTS=-Xmx768m
Windows
set MAVEN_OPTS=-Xmx768m
4. Start an instance of the Fuse ESB.
Building the examples To build all the examples in the examples folder:
1. In a command prompt or terminal, change to the InstallDir/examples
directory.
25 Fuse ESB Product Introduction Version 4.4.1
Running the Examples
2. Type mvn install
Deploying examples Once you have built an example, you can deploy it by copying the JAR file
generated in the example's target directory to the InsallDir/deploy folder.
Installing examples features Several of the examples make use of the Fuse ESB features facility. A feature
is a named, versioned collection of OSGi bundles that work together to provide
some functionality.
Fuse ESB includes a number of features that make the running of the examples
quick and easy. Each feature enables you to use a single command to install
the example bundle and any bundles that the example depends on.
To view a list of the features that are used by the examples, enter the following
command in the Fuse ESB console:
features:list | grep examples
A list of examples features is returned:
[uninstalled] [4.1.0-psc-01-00 ] examples-cxf-osgi
repo-0
[uninstalled] [4.1.0-psc-01-00 ] examples-cxf-jaxrs
repo-0
[uninstalled] [4.1.0-psc-01-00 ] examples-cxf-nmr
repo-0
[uninstalled] [4.1.0-psc-01-00 ] examples-camel-osgi
repo-0
[uninstalled] [4.1.0-psc-01-00 ] examples-camel-nmr
repo-0
[uninstalled] [4.1.0-psc-01-00 ] examples-cxf-camel-nmr
repo-0
[uninstalled] [4.1.0-psc-01-00 ] examples-cxf-ws-addressing
repo-0
[uninstalled] [4.1.0-psc-01-00 ] examples-cxf-wsdl-first-osgi-package
repo-0
[uninstalled] [1.1.0-psc-01-00 ] examples-nmr
repo-0
To install an examples feature, use the features:install command, as shown:
Fuse ESB Product Introduction Version 4.4.1 26
Chapter 3. Fuse ESB Basics
features:install examples-cxf-osgi
27 Fuse ESB Product Introduction Version 4.4.1
Running the Examples
Using the Web Console
The Apache Karaf Web Console provides you with a graphical overview of
your Fuse ESB installation.
You can use it to:
Install and uninstall features
Stop, start, and uninstall bundles
Create new instances of Fuse ESB
Configure your Fuse ESB instance
View logging information
Installing the web console feature The web console is not installed by default. To install it, run the following
from the karaf> prompt:
features:install webconsole
Accessing the web console By default, the console runs on port 8181. You can change the port number
by creating the properties file, etc/org.ops4j.pax.web.cfg, and adding
the following property setting (changing the port number to whatever value
you want):
org.osgi.service.http.port=8181
To access the console for an instance of Fuse ESB running locally, enter the
following address in your web browser:
http://localhost:8181/system/console
Log in with the username smx and the password smx.
Warning
Once you enable the web console, your Fuse ESB will be accessible
via HTTP from a remote machine. For this reason, we recommend
that you change the default username and password in the
Fuse ESB Product Introduction Version 4.4.1 28
Chapter 3. Fuse ESB Basics
etc/users.properties file. See "Configuring JAAS Security" in
Configuring and Running Fuse ESB for details.
Figure 3.4. The Web Console
29 Fuse ESB Product Introduction Version 4.4.1
Using the Web Console
Fuse ESB Product Introduction Version 4.4.1 30
Chapter 4. Deploying a Web Service
into Fuse ESB
Here we will take an indepth look at the CXF OSGi example, a JAX-WS web service packaged as an OSGi bundle.
Deploying the Example ............................................................................................................ 32
Running a client .................................................................................................................... 34
Understanding the Example ...................................................................................................... 36
You are going to build and deploy a simple service that is based on a WSDL
document. The source for this example can be found in the
InstallDir/examples/cxf-osgi folder of your Fuse ESB installation.
The example uses the Fuse ESB Maven tooling to build a bundle that contains
the service implementation and all of the metadata needed to deploy it into
the Fuse ESB container.
The sample code includes a web page, client.html, that will allow you to
access the service once it is exposed.
31 Fuse ESB Product Introduction Version 4.4.1
Deploying the Example
Before you run the example, start Fuse ESB.
Installing a prebuilt version of the
example
To install and run a prebuilt version of this example, enter the following
command in the Fuse ESB console:
features:install examples-cxf-osgi
Building and deploying the
example yourself
To build and deploy the example do the following:
1. If you installed the examples-cxf-osgi feature, first uninstall it by running
the following from the Fuse ESB console:
features:uninstall examples-cxf-osgi
2. In a separate command window or terminal, change to the root folder
of the example.
cd InstallDir/examples/cxf-osgi
3. Enter the following command:
mvn install
This command will build a bundle called
cxf-osgi-4.4.1-fuse-00-08.jar and place it into the target folder
of the example.
4. Copy the bundle to InstallDir/deploy to deploy it to the container.
Testing the example To see if the example is running you can visit http://localhost:8181/cxf/
HelloWorld?wsdl in your Web browser. You should see the WSDL shown in
Example 4.1 on page 32.
Example 4.1. CXF OSGi Example WSDL
<wsdl:definitions name="HelloWorldImplService"
targetNamespace="http://cxf.examples.servicemix.apache.org/">
<wsdl:types>
<xs:schema attributeFormDefault="unqualified"
elementFormDefault="unqualified"
Fuse ESB Product Introduction Version 4.4.1 32
Chapter 4. Deploying a Web Service into Fuse ESB
targetNamespace="http://cxf.examples.servicemix.apache.org/">
<xs:complexType name="sayHi">
<xs:sequence>
<xs:element minOccurs="0" name="arg0" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="sayHiResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="sayHi" nillable="true" type="sayHi"/>
<xs:element name="sayHiResponse" nillable="true" type="sayHiResponse"/>
</xs:schema>
</wsdl:types>
<wsdl:message name="sayHiResponse">
<wsdl:part element="tns:sayHiResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="sayHi">
<wsdl:part element="tns:sayHi" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="HelloWorld">
<wsdl:operation name="sayHi">
<wsdl:input message="tns:sayHi" name="sayHi">
</wsdl:input>
<wsdl:output message="tns:sayHiResponse" name="sayHiResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="HelloWorldImplServiceSoapBinding" type="tns:HelloWorld">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="sayHi">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="sayHi">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="sayHiResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="HelloWorldImplService">
<wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="HelloWorldImplPort">
<soap:address location="http://localhost:8181/cxf/HelloWorld"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
33 Fuse ESB Product Introduction Version 4.4.1
Deploying the Example
Running a client
You can run either a web client or a Java client against the deployed web
service.
Running the web client To run the web client:
1. Open the client.html, which is located at the root of the cxf-osgi
example folder.
2. Click the Send button to send a request.
Figure 4.1. Example Client HTML Screen
Once the request has been successfully sent, a response message appears
in the right-hand panel of the web page
Running the Java client To run the Java client:
1. In a command prompt or terminal, change to the
InstallDir/examples/cxf-osgi directory.
2. Run the following command:
mvn compile exec:java
Fuse ESB Product Introduction Version 4.4.1 34
Chapter 4. Deploying a Web Service into Fuse ESB
If the client request is successful, a response similar to the following is
returned to the command window:
the response is =====>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envel
ope/"><soap:Body>
<ns2:sayHiResponse xmlns:ns2="http://cxf.examples.service
mix.apache.org/">
<return>Hello John Doe</return></ns2:sayHiRe
sponse></soap:Body></soap:Envelope>
35 Fuse ESB Product Introduction Version 4.4.1
Running a client
Understanding the Example
Overview The example builds a simple HelloWorld service and packages it for
deployment into Fuse ESB. The service is written using standard JAX-WS
APIs. It implements a single operation sayHi(). Once deployed, the service
is exposed as a SOAP/HTTP endpoint. The most interesting parts of the
example are the Spring configuration used to configure the endpoint and the
Maven POM used to build the bundle.
The Spring configuration provides the details needed to expose the service
using SOAP/HTTP. It can also contain details used to configure advanced
Apache CXF functionality.
The Maven POM, in addition to compiling the code, uses the bundle generation
plug-in to package the resulting classes into an OSGi bundle. It contains all
of the details needed by the Fuse ESB container to activate the bundle and
deploy the packaged service.
Using the Maven tools The Fuse ESB Maven tooling automates a number of the steps in packaging
functionality for deployment into Fuse ESB. In order to use the Maven OSGi
tooling, you add the elements shown in Example 4.2 on page 36 to your
POM file.
Example 4.2. POM Elements for Using Fuse ESB OSGi Tooling
...
<pluginRepositories>
<pluginRepository>
<id>fusesource.m2</id>
<name>ESB Open Source Community Release Repository</name>
<url>http://repo.fusesource.com/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
Fuse ESB Product Introduction Version 4.4.1 36
Chapter 4. Deploying a Web Service into Fuse ESB
<artifactId>maven-bundle-plugin</artifactId>
...
</plugin>
</plugins>
</build>
...
These elements point Maven to the correct repositories to download the Fuse
ESB Maven tooling and load the plug-in that implements the OSGi tooling.
The Spring configuration The Fuse ESB container needs some details about a service before it can
instantiate and endpoint for it. Apache CXF uses Spring based configuration
to define endpoints for services. The configuration shown in
Example 4.3 on page 37 is stored in the example's
\src\main\resources\META-INF\spring\beans.xml file.
Example 4.3. OSGi Example Spring Configuration
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframe
work.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
<import resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml" />
<jaxws:endpoint id="helloWorld"
implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl"
address="/HelloWorld"/>
</beans>
The configuration shown in Example 4.3 on page 37 does the following:
Imports the required configuration to load the required parts of the
Apache CXF runtime.
Configures the endpoint that exposes the service using the
jaxws:endpoint element and its attributes.
id is an identifier used by the configuration mechanism.
37 Fuse ESB Product Introduction Version 4.4.1
Understanding the Example
implementor specifies the class that implements the service. It must
be on the classpath.
address specifies the address at which the service will be exposed.
This address is relative to the containers HTTP address with cxf
appended to it.
The POM Example 4.4. OSGi POM
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="ht
tp://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-
v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.servicemix.examples</groupId>
<artifactId>examples</artifactId>
<version>4.4.1-fuse-00-08</version>
</parent>
<groupId>org.apache.servicemix.examples</groupId>
<artifactId>cxf-osgi</artifactId>
<packaging>bundle</packaging>
<version>4.4.1-fuse-00-08</version>
<name>Apache ServiceMix Example :: CXF OSGi</name>
<!-- Add ServiceMix repositories for snaphots and releases -->
...
<dependencies>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-ws-metadata_2.0_spec</artifactId>
<version>${geronimo.wsmetadata.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
Fuse ESB Product Introduction Version 4.4.1 38
Chapter 4. Deploying a Web Service into Fuse ESB
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
<Import-Package>
javax.jws,
javax.wsdl,
META-INF.cxf,
META-INF.cxf.osgi,
org.apache.cxf.bus,
org.apache.cxf.bus.spring,
org.apache.cxf.bus.resource,
org.apache.cxf.configuration.spring,
org.apache.cxf.resource,
org.apache.servicemix.cxf.transport.http_osgi,
org.springframework.beans.factory.config
</Import-Package>
<Private-Package>org.apache.servicemix.examples.cxf</Private-Package>
<Require-Bundle>org.apache.cxf.cxf-bundle</Require-Bundle>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
39 Fuse ESB Product Introduction Version 4.4.1
Understanding the Example
Fuse ESB Product Introduction Version 4.4.1 40
Index
A
Apache Felix Framework, 16
Apache Karaf, 15
Apache Maven, 25
Apache ServiceMix, 12
architecture, 13
B
B2B (see business-to-business)
business-to-business, 9
C
console, 18, 23
D
directory strucuture, 20
E
EAI (see enterprise application integration)
Eclipse Equinox, 16
enterprise application integration, 9
enterprise service bus, 9
ESB (see enterprise service bus)
examples, 25
I
integration, 9
K
kernel, 15
M
Maven tooling, 36
O
OSGi, 15
S
service oriented architecture, 9
shell (see console)
starting, 22
stopping, 22
41 Fuse ESB Product Introduction Version 4.4.1
Fuse ESB Product Introduction Version 4.4.1 42

Potrebbero piacerti anche