DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Securing Your Software Supply Chain with JFrog and Azure
Register Today

Trending

  • Decoding ChatGPT: The Concerns We All Should Be Aware Of
  • A Comprehensive Guide To Testing and Debugging AWS Lambda Functions
  • SRE vs. DevOps
  • Introduction to API Gateway in Microservices Architecture

Trending

  • Decoding ChatGPT: The Concerns We All Should Be Aware Of
  • A Comprehensive Guide To Testing and Debugging AWS Lambda Functions
  • SRE vs. DevOps
  • Introduction to API Gateway in Microservices Architecture
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. OSGi Bundle Communication Options

OSGi Bundle Communication Options

Ben O'Day user avatar by
Ben O'Day
·
Jul. 28, 12 · Interview
Like (1)
Save
Tweet
Share
8.10K Views

Join the DZone community and get the full member experience.

Join For Free
There are various approaches to communicating between bundles...each having its own benefits/tradeoffs. Here are my (in progress) notes on evaluating the options with regards to Fuse ESB 4.2...

OSGi Service Registry
This is the most common (and well documented) approach from a pure OSGi perspective. Simple XML can be used to both register APIs as services and access other bundle's services. The service registry then provides an abstraction layer and an event framework to support dynamic binding, reacting to service lifecycle changes, etc. The whiteboard pattern can also help better manage this interaction in more complex/demanding scenarios.

OSGi Import-Package/Export-Package
This approach is more direct and relies on OSGi bundle manifests to tell the classloader which classes to export (make available to other bundles) or import (find classes in other bundles). This has the effect of making any imported classes look like any other class in a bundle.

However, this tends to tightly couple bundles together and can cause various classloader/versioning issues when bundles get out of sync.

JMS
An ActiveMQ broker is provided with Fuse ESB and is easily setup/configured. JMS endpoints can then easily be setup using Camel to wrap access to POJO Java code, etc. This can easily serve as a bridge between bundles or even VMs/machines entirely. This approach povides the standard JMS benefits (guaranteed messaging, loose coupling, high performance, failover/load balancing, etc).

Some initial performance concerns usually arise when considering use of persistent XML messaging. Most performance concerns can be mitigated by varying the JMS QoS or even using serialized object messages instead of XML, etc.

HTTP (SOAP, REST)
Another classic approach is to provide HTTP endpoints to interact with a bundle. This provides a loosely coupled strategy bound to either a SOAP WSDL or REST request/response format. Camel components can be used to setup these endpoints and wrap requests to POJO Java code, etc.

Unfortunately, these endpoints aren't the easiest to configure/test and often impose a significant overhead in terms of marshaling request/response data around.

NMR
Though its roots were in JBI/XML based messaging, it has evolved to provide a more generic/configurable approach to bundle communication. It can be configured to be to be synchronous or asynchronous.  Also, the camel-nmr component makes it easy to define NMR endpoints to route data between bundles without the need to use JMS brokers or more complex HTTP definitions.

See this post from Adrian Trenaman for more details on the new NMR...

VM
VM uses asynchronous SEDA to send messages between entities in the same virtual machine.  This has the benefit of using a seperate thread for a producer and consumer.  
More to come on this...I'm still working out the differences between VM and NMR in OSGi.

Distributed OSGi (DOSGi)
This implements the remove services functionality using SOAP web services.  Its very new and I'm still coming up to speed on it...(thanks Ashwin for pointing this out)

More to come on this...see these page for now.

http://cxf.apache.org/distributed-osgi.html
http://osgithoughts.blogspot.com/2010/07/cxf-distributed-osgi-12-is-out.html

summary
This is clearly still a work in progress.  There are a lot of options and I'm still trying to get my head around the trade-offs of each approach (hence this page).  As time permits, I'll try to expand on these more...

If anyone has had good/bad experiences with these techniques or others, let me know...
Web Service Fuse ESB Trade-off XML Virtual Machine Data (computing) Java (programming language) SOAP REST Web Protocols

Published at DZone with permission of Ben O'Day, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Trending

  • Decoding ChatGPT: The Concerns We All Should Be Aware Of
  • A Comprehensive Guide To Testing and Debugging AWS Lambda Functions
  • SRE vs. DevOps
  • Introduction to API Gateway in Microservices Architecture

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: