A Progress So*ware Company OSGi for real in enterprise integration with Apache Karaf Dr. Adrian Trenaman, Sr. Principal Solution Architect, FuseSource [email protected]twitter: adrian_trenaman | linked-in adrian.trenaman http://trenaman.blogspot.com http://slideshare.net/trenaman
35
Embed
OSGi for real in the enterprise: Apache Karaf - NLJUG J-FALL 2010
Want to know how to design, implement and deploy modular enterprise integration solutions using OSGi? The Apache Karaf OSGi shell, used by Apache Felix and Apache ServiceMix, enhances core OSGi implementations like Felix or Equinox with an easy to use, extendible command shell, providing logging, hot deployment, configuration, container administration, clustering, high availability and easy 'feature-based' dependency management In this session, you'll learn how Karaf works, and how you can leverage Karaf either on its own or embedded within ServiceMix to deploy business logic, RESTful services, EIP-based integration flows and web services. You'll learn how to extend the command shell with your own commands, and, use Spring-DM *or* OSGi BluePrint Services to make using OSGi a walk in the park.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
A Progress So*ware Company
OSGi for real in enterprise integrationwith Apache Karaf
Dr. Adrian Trenaman, Sr. Principal Solution Architect,FuseSource
– Dynamic update of components• Concluding thoughts
A Progress So*ware Company
Apache Karaf - an overview
A Progress So*ware Company
Apache Karaf
• A powerful OSGi-based container, originally ‘ServiceMixKernel’– Supports Equinox and Felix OSGi runtimes– Supports any component that can be wrapped as a jar file
• Karaf hot-deploys any artifacts found in the deploy directory– OSGi bundles (incl. Spring DM and OSGi Blueprint)– Raw Spring/Blueprint files– Karaf Archives (coming soon!)
• It provides additional deployment capabilities through differentURL handlers– mvn: | file: | http: | wrap: | jbi: | etc...
• Extensible architecture means Karaf can support deploymentof different kinds of artifacts– Used by ServiceMix 4 to deploy JBI artifacts
A Progress So*ware Company
Apache Karaf - Deployment
• OSGi bundles• JBI artifacts• WARs• Spring / Blueprint
XML configs• Exploded archives• Monitor
configuration files
A Progress So*ware Company
Apache Karaf - logging
• The logging subsystem combines output from various loggersto provide a standard OSGi Log service– Based on OPS4j Pax Logging
(http://www.ops4j.org/projects/pax/logging)– Supports API for Apache Commons Logging, SLF4J, Log4j, Java
Util Logging– Combines all output into one synchronized log– Uses Log4j configuration for easy management
• Karaf also provides a set of console commands to display,view and change the log levels at runtime
A Progress So*ware Company
Apache Karaf - Console
• The console provides a command line interface, with whichusers can perform administrative tasks
• Commands take the form{subshell}:{command} [options]
– A sub-shell is a group of related commands– e.g. commands related to the OSGi framework begin with “osgi:”
• The console provides an SSH port for connecting to andissuing commands in a remote instance of the kernel– The ssh connection can be made secure
All XML files in the META-INF/spring directory areinterpreted as the same ‘SpringContext’, and all beans are initiatedon bundle start and destroyed onbundle stop.
All XML files in the OSGI-INF/blueprint directory areinterpreted as the same ‘Context’,and all beans are initiated on bundlestart and destroyed on bundle stop.
A Progress So*ware Company
Deploying POJO OSGi services
A Progress So*ware Company
POJO OSGi Service
public interface CustomerService {Customer lookupCustomer(String customerId);
}
public class CustomerServiceImpl implements CustomerService {public Customer lookupCustomer(String customerId) {