What is an Apache-Service Mix ?
Apache ServiceMix is an enterprise-class open-source distributed enterprise service bus (ESB) and service-oriented architecture (SOA) toolkit. It was built from the ground up on the semantics and APIs of the Java Business Integration (JBI) specification JSR 208 and released under the Apache License. ServiceMix 4 also fully supports OSGi. ServiceMix is lightweight and easily embeddable, has integrated Spring support and can be run at the edge of the network (inside a client or server), as a standalone ESB provider or as a service within another ESB. You can use ServiceMix in Java SE or a Java EE application server. ServiceMix uses ActiveMQ to provide remoting, clustering, reliability and distributed failover.
What is an ESB ?
"An Enterprise Service Bus (ESB) is a new architecture
that, exploits Web services, Messaging middleware,
intelligent routing, and transformation. ESBs act as a
lightweight, ubiquitous integration backbone through
which software services and application components
flow.”
What is an ESB ??
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 JMS
ESB Architecture
Apache ServiceMix - Architecture
§ ServiceMix employs a layered architecture based on OSGi
• The core : A lightweight runtime named “Karaf”, which extends
OSGi with powerful features for handling and managing OSGI
bundles
• The technology layer : A layer of component technologies that sits
on top of the core to support your applications
Apache ServiceMix–Core Layer Features
•Hot deployment support for OSGi bundles
• Dynamic configuration of services through the OSGi “ConfigurationAdmin” service
• Dynamic logging back-end provided by Log4J supports different APIs (SLF4J, Java Utils, JCL, Avalon, Tomcat, OSGi)
• Application provisioning through file-drop, Maven repository and remote download (http://)
• Administration via an extensible shell console
• Secure remote access via ssh
• Security framework based on JAAS
Apache ServiceMix – Technology Layer Features
o Spring Framework• ServiceMix loads an OSGi bundle into its runtime, or generates an
OSGi bundle on the fly, and then instantiates the Spring application context
o JMS Message Broker• ServiceMix deploys the Apache ActiveMQ broker (OSGi-ready)
o JAX-WS/JAX-RS Web Services support• ServiceMix deploys the Apache CXF runtime (OSGi-ready)
o Enterprise Integration Patterns (EIP) support• ServiceMix deploys the Apache Camel runtime (OSGi-ready)
o Java Business Integration (JBI) support• ServiceMix provides a JBI 1.0 container, to support legacy code• implemented as service units / service assemblies and deployed using
ServiceMix 3.xo Can be extended to support technologies such as SCA or EJB3
Apache ServiceMix – Deployment Model
o When you deploy a ServiceMix solution, you typically
deploy the core (Karaf) plus one or more technology
Components
o Examples:
• To support EIPs : Karaf runtime + Camel feature
• To support JAX-WS/JAX-RS solutions : Karaf runtime + CXF feature
• To support JMS solutions : Karaf runtime + ActiveMQ feature
• To support JBI-based solutions : Karaf runtime + JBI feature
JBI (Java Business Integration)
JBI defines an architecture that allows the construction
of integration systems from plug-in components, that
interoperate through the method of mediated message
exchange.
JBI
2 kinds of components● Service Engine (SE)Allow implementing business logic or services on the ESBe.g. servicemix-drools or servicemix-bean● Binding Components Provide connectivity to external services(transport, normalization, ...)e.g. servicemix-ftp or servicemix-http
Message Routing
Apache ServiceMix – Integration container
Apache Camel – Integration Routes
Apache ActiveMQ - Messaging
Apache Karaf – OSGI Management
Overview of apache servicemix
Apache Felix - OSGI Apache Aries – OSGI enterprise
Installation
System requirements• Java Developer Kit (JDK) 1.6.x (Java 6), for both deployment and
compiling. (Note: Java 7 is currently not supported)• About 100 MB of free disk space
Downloading Apache ServiceMix• Apache ServiceMix 4.4.2 is available under the Apache License v2 and
can be downloaded from http://servicemix.apache.org/downloads.html.
Depending on your operation system, you should download either the tar.gz or the zip file:
• tar.gz for Linux/Unix/MacOS X • zip for Windows
Installation
On Linux/Unix/MacOS XOn a command shell, navigate to the directory where you extracted ServiceMix and the bin/servicemix shell script
Example: if ServiceMix is installed in the ~/Applications/apache-servicemix-4.4.2 directory.
$ cd ~/Applications/apache-servicemix-4.4.2$ ./bin/servicemix
!/quickstart/images/start-linux.png|width=75%|height=75%!
Apache ServiceMix 4.4.2
Apache ServiceMix console
Working with bundles• When ServiceMix is first started, a whole set of bundles providing the core features
for the product are being installed. Let's use the command console to find out more about them...
• The osgi:list command can be used to get a list of all bundles currently installed. Enter this
karaf@root> osgi:list
For every bundle, you see:
• the bundle id
• the bundle state
• if the bundle contains a Blueprint or Spring XML file, the next 2 columns will show you if the
beans defined there were created successfully
• the bundle start level
• the bundle name and version
Apache ServiceMix console
KARAF – It is a command line tool used to install/uninstall parts of a SMX application and also to troubleshoot problems
Apache ServiceMix console
Grep command in karafkaraf@root> osgi:list | grep camel
Apache ServiceMix console
Working with logging
• To look at the message in the log file- karaf@root> log:display
• If you're only interested in the latest exception in the log file- karaf@root> log:display-exception
• You can also change the log level at runtime by using the log:set command. You can try these commands on your instance now by first setting the log level to DEBUG and then using grep to make sure that you can actually see the extra logging.
- karaf@root> log:set DEBUG- karaf@root> log:display | grep DEBUG
Checking Logs file
karaf@root>log:display-exception it display the current exception
Checking Logs file
karaf@root>log:set DEBUG to set the logs in DEBUG Modekaraf@root>log:displaykaraf@root>log:set INFO to set the logs in INFO Modekaraf@root>log:display
Other Optional features:The list of features is available with the features:list command, we are taking some of few regular basis command.This command shows the status weather it is installed or not, and other tab shows version and Name.and grep to find the things in the list that you're interested in. karaf@root> features:listkaraf@root> features:list | grep camel
Web console:To get the web console installed in ServiceMix, install the feature from your consolekaraf@root> features:install webconsolekaraf@root> features:list | grep webconsole
your browser to http://localhost:8181/system/console and login with user smx and password smx to access the web console
Servicemix-camel : The servicemix-camel component provides support for using Apache Camel to provide a full set of Enterprise Integration Patterns and flexible routing and transformation in both Java code or Spring XML to route services on the Normalized Message Router
Camel –Route and Active MQ Deployment : The way to deploy the Camel route Blueprint and Active MQ XML files both having same procedure.
1)Create a new file having the Below configration in the Deployment directory.2)When the file deployed sucessfully it creates two folder in the home directory (as per specified in Blueprint.XML file) 3)One is HOME/ input and Home/output dir4)Now copy a file in the input Dir5)It automatically copied to output Dir
For ActiveMQ it create a new dir under HOME is ActiveMQ and under this we have two sub directory Input and Output
Let see in our new slide…
Servicemix-camel : Overview Diagram
Camel Route:1) Define the route in a Blueprint XML file in deployment folder having the below configrations.2) Just create a new XML file in the deploy folder with the code below to start a route to copy files from one directory to another.
Check in Logs by log:display we got the below massage for the file sucessfully moved
To Stop and Starts the Route below are the commands:
karaf@root> osgi:stop 200
karaf@root> osgi:start 200
To Stop and Starts the Route below are the commands:
karaf@root> osgi:stop 200
karaf@root> osgi:start 200
Adding ActiveMQ to the ServiceMix: Apache ServiceMix instance comes with an embedded ActiveMQ JMS broker. This makes it easy to communicate between Camel routes using persistent messages on the same machine, but it will also enable you to distribute your routes over multiple instances afterwards for clustering or load-balancing.
Save this file in ServiceMix' deploy folder and use osgi:list to check on the bundle status
You should now be able to put files in the activemq/input directory and see them being moved to activemq/output.
Receiving the event messages: After deploying the first XML file, you're obviously not seeing any events being logged yet. The event messages are sent to an ActiveMQ queue, but there's nobody to receive the events yet. Let's change that now by creating a second Blueprint XML file.
Checking Logs file: As soon as this second file has been deployed, you'll start seeing the event messages in your log:display output
Thank You for Attending!
Top Related