osgi as enterprise integration platform
TRANSCRIPT
OSGi as Enterprise Integration Platform
Elek Márton@anzix
2014 SeptemberDPC Consulting
AgendaTypical question:
JavaEE or Spring based application?Our question:
Is the OSGi good enough for a third way?● What is OSGi
– Classpath separation– Service definitions– Lifecycle
● How does an OSGi application server looks like?– Felix, Karaf, ServiceMix– JBoss Fuse, Fabric8.io
OSGi
What is OSGi● Modular system and service platform for Java
– Specification (similar to J2EE)– Ecosystem (eg. exams are announced at 2014.09)
● Jigsaw vs. OSGi interoperability ???? – (PoC: project penrose)
OSGi R1 2000.05
OSGi R2 2001.10
OSGi R3 2003.03
OSGi R4 2005.10
OSGi R4.1,4.2,4.3 2009.09-2011.04
OSGi R5 2012.06
J2EE 1.2 1999.12
J2EE 1.3 2001.09
J2EE 1.4 2003.11
JavaEE 5 2006.05
JavaEE 6 2009.12
JavaEE 7 2013.06
● OSGi runtime is collection of bundles● Bundle:
– Plain old jar file– With plain old META-INF/MANIFEST.MF
● With OSGi specific entries in the manifes
OSGi bundle
Classpath separation● Package based● Bundles explicitly
imports and exports packages– META-INF/MANIFEST.MF
Bundle1
Export-Package: hu.dpc.helloworld
;version="1.0.0"
Bundle2
Import-Package: hu.dpc.helloworld
;version="1.0.0"
Lifecycle management● Every bundle has a lifecycle.● Activator in
META-INF/MANIFEST.MF
Bundle-Name: Hello World
Bundle-SymbolicName: hu.dpc.helloworld
Bundle-Activator: hu.dpc.Activator
Service definition● API to publish/use implementation for a specific
interface– With optional metadata set
● Programmatic API: there are extensions to use declarative approach– blueprint– DS (declarative services
● Main set of useful interfaces– Logging, Config Admin, Http, ...
Runtime container
Apach FelixOSGi container
Apache Karaf
Apach FelixOSGi container
Hibernate
Spring
CXF
● Hot deployment● Dynamic configuration
○ (etc/*.properties -> OSGi config API)● Provisioning (feature definition)● KAR archive● More advanced shell● Instance management
○ Parent container/Child container○ The binaries are shared
Apache Karaf
Apach FelixOSGi container
Apache ServiceMix
Hibernate
Spring
CXF
Camel ServiceMix
● Hot deployment● Dynamic configuration
○ (etc/*.properties -> OSGi config API)● Provisioning (feature definition)● KAR archive● More advanced shell● Instance management
○ Parent container/Child container○ The binaries are shared
Apache Karaf
Apach FelixOSGi container
Apache ServiceMix
JBoss Fuse
● Clustering / auto provisioning● Microservice management
Hibernate
Spring
CXF
Fabric
Camel ServiceMix
● Hot deployment● Dynamic configuration
○ (etc/*.properties -> OSGi config API)● Provisioning (feature definition)● KAR archive● More advanced shell● Instance management
○ Parent container/Child container○ The binaries are shared
Apache Karaf
Apach FelixOSGi container
Apache ServiceMix
JBoss Fuse / FABRIC8.IO
● Clustering / auto provisioning● Microservice management
Hibernate
Spring
CXF
Fabric
Camel ServiceMix
● Hot deployment● Dynamic configuration
○ (etc/*.properties -> OSGi config API)● Provisioning (feature definition)● KAR archive● More advanced shell● Instance management
○ Parent container/Child container○ The binaries are shared
Summary● Third way with own strength and weakness● Strength
– Modularity, Modularity, Modularity● Classloader separation● Lifecycle management● Service producer/consumer pattern
– Well defined standard service APIs– More control to fine tune the integration
● Weakness– Additional complexity even if the classloader separation
and the lifecycle management is not needed– Many different project should be used together– DIY environment, everything is possible, but more
knowledge needed about the platform.
Q&A