Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 13. Introduction to the Red Hat JBoss Fuse JMS Binding Component
Abstract
Overview Copier lienLien copié sur presse-papiers!
- Consumer Endpoints
- A Consumer endpoint's primary roll is to listen for messages on an external JMS destination and pass them into to the NMR for delivery to endpoints inside of the Red Hat JBoss Fuse container. Consumer endpoints can send responses if one is required.
- Provider Endpoints
- A Provider endpoint's primary roll is to take messages from the NMR and send them to an external JMS destination.
xbean.xml
file. There are some instances where you will need to develop your own Java classes to supplement the basic functionality provided by the binding components default implementations. These cases are discussed at the end of this guide.
Key features Copier lienLien copié sur presse-papiers!
- Support for JMS 1.0.2 and JMS 1.1
- JMS transactions
- XA transactions
- Support of all MEP patterns
- SOAP support
- MIME support
- Customizable message marshaling
Contents of a JMS service unit Copier lienLien copié sur presse-papiers!
xbean.xml
- The
xbean.xml
file contains the XML configuration for the endpoint defined by the service unit. The contents of this file are the focus of this guide.NoteThe service unit can define more than one endpoint. meta-inf/jbi.xml
- The
jbi.xml
file is the JBI descriptor for the service unit. Example 13.1, “JBI Descriptor for a JMS Service Unit” shows a JBI descriptor for a JMS service unit.Example 13.1. JBI Descriptor for a JMS Service Unit
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The elements shown in Example 13.1, “JBI Descriptor for a JMS Service Unit” do the following:- 1
- The
service
element is the root element of all service unit descriptors. The value of thebinding-component
attribute is alwaysfalse
. - 2
- The
service
element contains namespace references for all of the namespaces defined in thexbean.xml
file'sbean
element. - 3
- The
provides
element corresponds to a JMS provider endpoint. Theservice-name
attribute derives its value from theservice
attribute in the JMS provider's configuration.NoteThis attribute can also appear on aconsumes
element. - 4
- The
endpoint-name
attribute derives its value from theendpoint
attribute in the JMS provider's configuration.NoteThis attribute can also appear on aconsumes
element. - 5
- The
consumes
element corresponds to a JMS consumer endpoint. Theinterface-name
attribute derives its value from theinterfaceName
attribute in the JMS consumer's configuration.NoteThis attribute can also appear on aprovides
element.
Using the Maven JBI tooling Copier lienLien copié sur presse-papiers!
- servicemix-jms-consumer-endpoint
- The servicemix-jms-consumer-endpoint archetype creates a project that results in a service unit that configures a JMS consumer endpoint.TipYou can use the smx-arch command to in place of typing the entire Maven command.
smx-arch su jms-consumer ["-DgroupId=my.group.id"] ["-DartifactId=my.artifact.id"]
smx-arch su jms-consumer ["-DgroupId=my.group.id""-DgroupId=my.group.id""-DgroupId=my.group.id"] ["-DartifactId=my.artifact.id""-DartifactId=my.artifact.id""-DartifactId=my.artifact.id"]
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - servicemix-jms-provider-endpoint
- The servicemix-jms-provider-endpoint archetype creates a project that results in a service unit that configures a JMS provider endpoint.TipYou can use the smx-arch command to in place of typing the entire Maven command.
smx-arch su jms-provider ["-DgroupId=my.group.id"] ["-DartifactId=my.artifact.id"]
smx-arch su jms-provider ["-DgroupId=my.group.id""-DgroupId=my.group.id""-DgroupId=my.group.id"] ["-DartifactId=my.artifact.id""-DartifactId=my.artifact.id""-DartifactId=my.artifact.id"]
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
- a
pom.xml
file containing the metadata needed to generate and package the service unit - a
src/main/resources/xbean.xml
file containing the configuration for the endpointImportantThe endpoint configuration generated by the archetype is for the deprecated JMS endpoints. While this configuration will work, it is not recommended for new projects and is not covered in this guide.
java
folder to the generated src
folder. You also need to modify the generated pom.xml
file to compile the code and package it with the service unit.
OSGi Packaging Copier lienLien copié sur presse-papiers!
- include an OSGi bundle manifest in the
META-INF
folder of the bundle - add the following to your service unit's configuration file:
<bean class="org.apache.servicemix.common.osgi.EndpointExporter" />
<bean class="org.apache.servicemix.common.osgi.EndpointExporter" />
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Namespace Copier lienLien copié sur presse-papiers!
http://servicemix.apache.org/jms/1.0
namespace. You will need to add a namespace declaration similar to the one in Example 13.2, “Namespace Declaration for Using JMS Endpoints” to your xbeans.xml
file's beans
element.
Example 13.2. Namespace Declaration for Using JMS Endpoints
<beans ... xmlns:jms="http://servicemix.apache.org/jms/1.0" ... > ... </beans>
<beans ...
xmlns:jms="http://servicemix.apache.org/jms/1.0"
... >
...
</beans>
beans
element's xsi:schemaLocation
as shown in Example 13.3, “Schema Location for Using JMS Endpoints”.
Example 13.3. Schema Location for Using JMS Endpoints