Transcript
Page 1: ServiceMix 4 -- Integrating OSGi with JBI

ServiceMix 4Integrating JBI with OSGi

Page 2: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation2

Overview

Recent releases– Apache ServiceMix 3.2, 3.3 and 4.0.0

Dissecting ServiceMix 4.0.0– ServiceMix Kernel– ServiceMix NMR and JBI

Getting involved?

Page 3: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation3

Recent releases

Recent releases– ServiceMix 3.2.x– ServiceMix 3.3.x

• why separate components?– ServiceMix 4.x

• why a new container?

Page 4: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation4

ServiceMix 3.2.x

ServiceMix 3.2.x– JBI container and components

in one release

Page 5: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation5

ServiceMix 3.3.x

ServiceMix 3.3.1– JBI Container version 3.3.1– JBI Components version 2009.01

Page 6: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation6

ServiceMix 3.3.x – Component versioning

Rationale for separate components versioning– share component between

ServiceMix 3.x and 4.x containers– ensure container independence

• build using JBI API and shared library• be able to test/run in both containers

(as well as other JBI containers)– ease migration from 3.x to 4.x

Page 7: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation7

ServiceMix 4.x

ServiceMix 4.0.0 and beyond– Modular OSGi-based container

• ServiceMix Kernel, ServiceMix NMR– JBI Components version 2009.01

Page 8: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation8

So what?

We started with a JBI container and components...

...and we ended with one

Why should I care?

Page 9: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation9

Dissecting ServiceMix 4

Page 10: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation10

Dissecting ServiceMix 4

ServiceMix Kernel– overview of features– example: create a Camel container

ServiceMix NMR– NMR features– example:

NMR for loosely-coupled integration– JBI features– example: OSGi packaging for JBI

Page 11: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation11

ServiceMix Kernel

Page 12: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation12

ServiceMix Kernel

A flexible OSGi-based server runtime Features:

– easy-to-use provisioning– hot-deployment– Spring integration– powerful command shell, available over ssh– JMX management– container-level locking– ...

Page 13: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation13

ServiceMix Kernel

A flexible OSGi-based server runtime Features:

– easy-to-use provisioning– hot-deployment– Spring integration– powerful command shell, available over ssh– JMX management– container-level locking– ...

Apache Felix Karaf

Page 14: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation14

ServiceMix Kernel – Console

Console– Management of ServiceMix Kernel

• locally when running ServiceMix Kernel• remotely using SSH connection

– <subshell>/<command> syntax• Just a few examples

– OSGi bundle management: osgi/list,headers,install, ... – OSGI ConfigAdmin: config/list,edit,update, ... – file-system access: ls, cp, rm, mv, ...

• With UNIX-like utilities, pipes, globbing, ...

Page 15: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation15

ServiceMix Kernel – Console

Find, stop and restart a JAAS bundle smx@root:/> osgi/list | grep JAAS [ 21] [Active ] [Started] [ 30] JAAS Config (1.2.0.SNAPSHOT) [ 29] [Active ] [Started] [ 30] JAAS Modules (1.2.0.SNAPSHOT) smx@root:/> osgi/stop 29 smx@root:/> osgi/start 29

Update the SSH port configuration smx@root:/> config/edit org.apache.servicemix.shell smx@root:/> config/propset sshPort 8100 smx@root:/> config/update

Create, start and manage a second instance smx@root:/> admin/create slave Creating new instance on port 8102 at: C:\<smx_home>\instances\slave Creating dir: C:\<smx_home>\instances\slave\bin ...

smx@root:/> admin/start slave smx@root:/> admin/list Port State Pid Name [ 8102] [Starting] [ 5896] slave

Page 16: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation16

ServiceMix Kernel - Features

Features– Karaf-specific way for installing applications

• install the bundle• add configuration defaults

– Using the command shell or JMX

smx@root:/> features/addUrl mvn:org.apache.servicemix/apache-servicemix/4.0.0/xml/features

smx@root:/> features/install websmx@root:/> features/install activemq

Page 17: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation17

Apache ServiceMix Kernel - Hot-deployment

Hot-deployment– uses the deploy directory– allows deployment of

• bundles• features descriptors• Spring XML files

– extensible mechanism• deploy WAR files with web feature installed• deploy JBI artifactswith ServiceMix JBI

layer

Page 18: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation18

Apache ServiceMix Kernel – Spring integration

Spring integration– automatically load and start Spring context

• from a plain XML file• from a bundle containing XML files in the

META-INF/spring folder– Spring DM support for OSGi interaction

• ConfigAdmin• Service Registry

Page 19: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation19

ServiceMix Kernel – Camel Example

Example: Use ServiceMix Kernel for Camel– Add the features descriptor url– Install the camel-osgi features...– … and any other camel component you

need

smx@root:/> features/addUrl mvn:org.apache.camel.karaf/features/2.0-SNAPSHOT/xml/featuressmx@root:/> features/install camel-osgismx@root:/> features/install camel-ftp

Page 20: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation20

ServiceMix Kernel – Camel Example

Now, create this XML file in the deploy directory<?xml version="1.0"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

<camelContext xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="ftp://[email protected]/orders?password=secret"/> <to uri="file:/home/orders/in"/> </route> </camelContext>

</beans>

Page 21: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation21

ServiceMix NMR/JBI

Using ServiceMix Kernel to build a JBI container We are using a 2 layer solution

– NMR API for messaging– JBI specification implementation

Page 22: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation22

ServiceMix NMR

Page 23: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation23

ServiceMix NMR

ServiceMix 4 NMR– easy to use messaging API

(Exchange, Message, Endpoint, ...)– handles XML and POJO payloads– listener interfaces to monitor the NMR

(ExchangeListener, EndpointListener, …)– support for wiring endpoints and intercepting

exchanges– command shell for managing the NMR

Page 24: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation24

ServiceMix NMR

ServiceMix 4 NMR– installable as a ServiceMix Kernel feature– You can use it for loosely coupled

integration• Camel routes• CXF web services• … add anything else yourself here

– We use it to build our JBI integration layer

Page 25: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation25

ServiceMix NMR

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="...">

<import resource= "classpath:org/apache/servicemix/camel/nmr/camel-nmr.xml" />

<camelContext xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="ftp://[email protected]/orders?password=secret"/> <to uri="nmr:IncomingOrders"/> </route>

<!-- the second route can be in another bundle --> <route> <from uri="nmr:IncomingOrders"/> <to uri="file:/home/orders/in"/> </route> </camelContext>

</beans>

Page 26: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation26

ServiceMix JBI

Page 27: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation27

ServiceMix JBI

ServiceMix 4 JBI– installable as a ServiceMix Kernel feature– runs on top of ServiceMix NMR– it adds

• JBI Messaging API• JBI Deployment and packaging• JBI Management Mbeans

Page 28: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation28

ServiceMix JBI

ServiceMix 4 JBI: Deployment models– JBI packaging

• For strict JBI compatibility• For compatibility with ServiceMix 3

just drop your SA in the deploy directory– OSGi packaging

• Deploy config in a bundle or plain XML file• Add the OSGi exported to get it linked up

with the JBI components

Page 29: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation29

ServiceMix JBI – JBI packaging

Page 30: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation30

ServiceMix JBI – OSGi packaging

<?xml version="1.0"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:my="urn:my:ns" xmlns:file="http://servicemix.apache.org/file/1.0" xmlns:ftp="http://servicemix.apache.org/ftp/1.0" xmlns:xsi="..." xsi:schemaLocation="...">

<ftp:poller service="my:ftp" endpoint="endpoint" targetService="my:file" uri="ftp://gert:[email protected]/orders"/>

<file:sender service="my:file" endpoint="endpoint" directory="/home/orders/in"/> <bean class="org.apache.servicemix.common.osgi.EndpointExporter" /> </beans>

Deploy plain XML file or bundle with entire config– EndpointExporter integrates with NMR/JBI

Page 31: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation31

ServiceMix JBI

ServiceMix 4 JBI Cluster Engine– replacement for JMS/JCA Flow

• all or nothing clustering• no fine-grained control over transactions

– JBI cluster engine is installable as a feature– add a cluster registration for every

clusterable endpoint to the JBI configuration

<bean class="o.a.s.jbi.cluster.engine.OsgiSimpleClusterRegistration"> <property name="serviceName" value="test:myService" /> <property name="endpointName" value="myEndpoint" /> </bean>

Page 32: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation32

ServiceMix JBI

Page 33: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation33

Getting involved?

Getting involved?– Start using the product

• Versioning of ServiceMix and FUSE ESB– Get in touch– Contribute

Page 34: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation34

Getting involved?

Start using the product– Apache ServiceMix

• development happens here• (b)leading edge• ideal for following up on future direction or

for experimenting– FUSE ESB

• stable versions only• regular fix releases• ideal for use in projects/production

Page 35: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation35

Getting involved?

Versioning of ServiceMix and FUSE ESB

Apache ServiceMix FUSE ESB Features

3.2.x 3.3.1.x JBI container and components (single release)

3.3.x 3.4.1.x JBI container and shared components

/ 4.0.0.x Special FUSE ESB previewOSGi-functionality only

4.0.0 4.1.0.0 OSGi-based JBI container with the shared components

Page 36: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation36

Getting involved?

Get in touch– Apache ServiceMix

• mailing list [email protected]• #servicemix on irc.codehaus.org

– Apache Felix• mailing list [email protected]

– FUSE• forums on http://www.fusesource.com

Page 37: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation37

Getting involved?

Contribute– give us some feedback

• reportings bugs• suggestions for new features

(what would you like in ServiceMix 4.1?)– we welcome all kinds of contributions

• involvement on the mailing list/forum• documentation• patches – we really love patches ;)• ...

Page 38: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation38

Getting involved?

Learn about ServiceMix and FUSE ESB– Apache ServiceMix

• http://servicemix.apache.org

– Apache Felix Karaf• http://felix.apache.org/site/apache-felix-karaf.html

– FUSE ESB• http://www.fusesource.com

more tutorials, webinars, docs, ...

Page 39: ServiceMix 4 -- Integrating OSGi with JBI

© 2009 Progress Software Corporation39

Questions? Remarks?


Top Related