osgi as enterprise integration platform

16
OSGi as Enterprise Integration Platform Elek Márton @anzix 2014 September DPC Consulting

Upload: dpc-consulting-ltd

Post on 16-Apr-2017

430 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: OSGi as Enterprise Integration Platform

OSGi as Enterprise Integration Platform

Elek Márton@anzix

2014 SeptemberDPC Consulting

Page 2: OSGi as Enterprise Integration Platform

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

Page 3: OSGi as Enterprise Integration Platform

OSGi

Page 4: OSGi as Enterprise Integration Platform

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

Page 5: OSGi as Enterprise Integration Platform

● 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

Page 6: OSGi as Enterprise Integration Platform

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"

Page 7: OSGi as Enterprise Integration Platform

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

Page 8: OSGi as Enterprise Integration Platform

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, ...

Page 9: OSGi as Enterprise Integration Platform

Runtime container

Page 10: OSGi as Enterprise Integration Platform

Apach FelixOSGi container

Page 11: OSGi as Enterprise Integration Platform

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

Page 12: OSGi as Enterprise Integration Platform

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

Page 13: OSGi as Enterprise Integration Platform

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

Page 14: OSGi as Enterprise Integration Platform

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

Page 15: OSGi as Enterprise Integration Platform

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.

Page 16: OSGi as Enterprise Integration Platform

Q&A