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.이 콘텐츠는 선택한 언어로 제공되지 않습니다.
18.2. Provider Marshalers
Overview 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
Providers use an implementation of the
org.apache.servicemix.jms.endpoints.JmsProviderMarshaler
interface to convert normalized messages into JMS messages. The marshaler also converts the incoming reply from a JMS message into a normalized message. The JMS binding component comes with two provider marshaler implementations:
DefaultProviderMarshaler
- The
DefaultProviderMarshaler
class provides the marshaler used by generic provider endpoints. JmsSoapProviderMarshaler
- The
JmsSoapProviderMarshaler
class provides the marshaler used by SOAP provider endpoints.NoteThe default SOAP marshaler does not support the full range of SOAP messages nor does it support marshaling map based messages into JMS messages.
When the default provider marshalers do not suffice for your application, you can provide a custom implementation of the
JmsProviderMarshaler
interface.
Implementing the marshaler 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
To create a custom provider marshaler, you implement the
org.apache.servicemix.jms.endpoints.JmsProviderMarshaler
interface. The JmsProviderMarshaler
interface, shown in Example 18.4, “The Provider Marshaler Interface”, has two methods you need to implement:
Example 18.4. The Provider Marshaler Interface
createMessage()
- The
createMessage()
method uses information from the Red Hat JBoss Fuse core to generate a JMS message. Its parameters include the message exchange, the normalized message that is received by the provider, and the active JMS session. populateMessage()
- The
populateMessage()
method takes a JMS message and adds it to a message exchange for use by the Red Hat JBoss Fuse core.
Example 18.5, “Provider Marshaler Implementation” shows a simple provider marshaler implementation.
Example 18.5. Provider Marshaler Implementation
Configuring the provider 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
You configure a provider to use a custom marshaler using its
marshaler
attribute. The marshaler
attribute's value is a reference to a bean
element specifying the class of your custom marshaler implementation.
Example 18.6, “Configuring a Provider to Use a Customer Marshaler” shows configuration for a provider that uses a custom marshaler.
Example 18.6. Configuring a Provider to Use a Customer Marshaler
Note
You can also configure a provider to use a custom marshaler by adding a child
marshaler
element to the provider's configuration. The marshaler
element simply wraps the bean
element that configures the marshaler.