JBI has been edited by willem jiang (Mar 11, 2009). Content:JBI ComponentThe jbi: component is provided by the ServiceMix Camel module
Following code from("jbi:endpoint:http://foo.bar.org/MyService/MyEndpoint")
automatically exposes new endpoint to the bus where service qname is {http://foo.bar.org
For more details of valid JBI URIs see the ServiceMix URI Guide Using the jbi:service: or jbi:endpoint: URI forms will set the service QName on the JBI endpoint to the exact one you give. Otherwise the default Camel JBI Service QName will be used which is {http://activemq.apache.org/camel/schema/jbi}endpoint
Examplesjbi:service:http://foo.bar.org/MyService jbi:endpoint:urn:foo:bar:MyService:MyEndpoint jbi:endpoint:http://foo.bar.org/MyService/MyEndpoint jbi:name:cheese URI options
Examplesjbi:service:http://foo.bar.org/MyService?mep=in-out (override the MEP, use InOut JBI MessageExchanges) jbi:endpoint:urn:foo:bar:MyService:MyEndpoint?mep=in (override the MEP, use InOnly JBI MessageExchanges) jbi:endpoint:urn:foo:bar:MyService:MyEndpoint?operation={http://www.mycompany.org}AddNumbers (overide the operation for the JBI Exchange to {http://www.mycompany.org}AddNumbers) Using Stream bodiesIf you are using any stream types as bodies then you should be aware that a stream is only capable of being read once. So if you are enabling DEBUG logging then the body is usually debug logged and thus read. To cater for this Camel has streamCaching that caches the stream is it can be read multiple times. from("jbi:endpoint:http://foo.bar.org/MyService/MyEndpoint").streamCaching().to("xslt:transform.xsl", "bean:doSomething");
In Camel 1.5 onwards the stream caching is default enabled, so adding streamCaching() is not needed. Creating a JBI Service UnitIf you have some Camel routes you want to deploy inside JBI as a Service Unit you can use the JBI Service Unit Archetype to create a new project. If you have an existing maven project which you need to convert into a JBI Service Unit you may want to refer to the ServiceMix Maven JBI Plugins
Your pom.xml should look something like this to enable the jbi-service-unit packaging. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>myGroupId</groupId> <artifactId>myArtifactId</artifactId> <packaging>jbi-service-unit</packaging> <version>1.0-SNAPSHOT</version> <name>A Camel based JBI Service Unit</name> <url>http://www.myorganization.org</url> <properties> <camel-version>1.0.0</camel-version> <servicemix-version>3.3</servicemix-version> </properties> <dependencies> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-jbi</artifactId> <version>${camel-version}</version> </dependency> <dependency> <groupId>org.apache.servicemix</groupId> <artifactId>servicemix-core</artifactId> <version>${servicemix-version}</version> <scope>provided</scope> </dependency> </dependencies> <build> <defaultGoal>install</defaultGoal> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> <!-- creates the JBI deployment unit --> <plugin> <groupId>org.apache.servicemix.tooling</groupId> <artifactId>jbi-maven-plugin</artifactId> <version>${servicemix-version}</version> <extensions>true</extensions> </plugin> </plugins> </build> </project> See Also |
Unsubscribe or edit your notifications preferences