Loose coupling in JBI

Loose coupling is a feature that can be easily achieved in JBI but which is sometimes not well understood by newbies in the JBI world.

In JBI, services are exposed inside the bus by JBI components when you deploy a given service onto it. These components can be Service Engines (contain business logic) or Binding Components (handling a specific protocol). The distinction is the key for loose coupling: the service itself it decoupled from the protocols used to access it. This is true for all services accessed from inside the JBI bus, be it internal to the bus or external to it.

Let's take an example. You need to write a BPEL process and expose it over SOAP/HTTP, and this process will consume several other services. These services can be inside the JBI bus, accessible via SOAP/HTTP or plain JMS. The important point is that the BPEL process has no knowledge of the protocol and location of these services. How does it work ?

The key is the WSDL. A WSDL can be split into two parts: the abstract and the concrete model. The abstract model contains the interface (Port) definition along with the messages and xml structures definition. The concrete part contains the binding (tying the service to a particular protocol) and service definition (location and binding for a given service). When JBI components talk together, they only use the abstract WSDL definition which does not contain any protocol or location information. The NMR will select a JBI endpoint based on some informations (name of the interface, name of the service) and will send the JBI exchange to the selected endpoint. If the endpoint has been activated by a Service Engine, it means that the service is hosted inside the JBI bus, and not protocol transformation will be performed. However, if the endpoint is activated from a Binding Component, the endpoint will act as a proxy for an external service provider: the binding component will send a request to the service in the protocol it handles to the known location, but the consumer (the BPEL process) has no knowledge of the exact protocol and location: the only things it needs is the contract (the abstract WSDL).

Take a look at ServiceMix and it's User's Guide.


Unknown said…
Now,Does Servicemix have a http bc support wsdl2.0?

Popular posts from this blog

Camel Endpoint DSL

ActiveMQ Pooling

Apache Karaf