...
3. Deploying JBI components without the JBI packaging
Warning |
---|
It does not work yet |
In ServiceMix Kernel (>= 1.0-m3-SNAPSHOT), run the following commands:
Code Block |
---|
features /addUrl mvn:org.apache.servicemix.nmr/apache-servicemix-nmr/1.0.0-m2-SNAPSHOT/xml/features features /install jbi osgi /install -s mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.wsdl4j-/1.6.1/4.0-m1_1 osgi /install -s mvn:org.apache.xbean/xbean-spring/3.4-SNAPSHOT5 osgi /install -s mvn:org.apache.servicemix/servicemix-servicesutils/3.3-SNAPSHOT1.1.0 osgi /install -s mvn:org.apache.servicemix/servicemix-common/32009.3-SNAPSHOT01 osgi /install -s mvn:org.apache.servicemix/servicemix-eip/32009.3-SNAPSHOT01 |
Then, create the following file:
Code Block | ||||
---|---|---|---|---|
| ||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:eip="http://servicemix.apache.org/eip/1.0" xmlns:test="urn:test" xmlns:osgi="http://www.springframework.org/schema/osgi" 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.xsd http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd http://servicemix.apache.org/eip/1.0 http://servicemix.apache.org/eip/1.0/servicemix-eip.xsd"> <bean class="org.apache.servicemix.common.osgi.EndpointExporter" /> <eip:wire-tap id="eip-endpoint" service="test:wireTap" endpoint="endpoint"> <eip:inListener> <eip:exchange-target service="test:listener" /> </eip:inListener> <eip:target> <eip:exchange-target service="test:target" /> </eip:target> </eip:wire-tap> </beans> |
3.1 Under the hood
How does it work under the hood ?
For each endpoint defined in the application context, the EndpointExporter
will create and register in the OSGi registry an object implementing org.apache.servicemix.common.osgi.EndpointWrapper
. Those objects are tracked by each individual ServiceMix JBI component. When a given component knows how to handle a given endpoint, it will internally create a service unit, deploy it, and inform the endpoint wrapper that it has been successfully deployed. The EndpointExporter
waits for all endpoint to be deployed and once this is done, will register a org.apache.servicemix.jbi.deployer.DeployedAssembly
object representing a JBI Service Assembly composed of all the deployed service units. Those DeployedAssembly
objects are tracked by the NMR JBI layer which can then handle those as standard JBI service assemblies.
At this point, the service units have been deployed, but not initialized and started, so that no JBI / NMR endpoint has been created yet. This will be done when the Service Assembly is actually initialized and started.
This quite complicated flow is necessary to be able to handle the JBI lifecycle of the Service Assembly in a nice way (starting, stopping, shutting down), because all service units lifecycle have to be managed through a service assembly in an atomic way.
Wiki Markup |
---|
{scrollbar} |