LibraryLink ToToggle FramesPrintFeedback

Provider Marshalers

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:

When the default provider marshalers do not suffice for your application, you can provide a custom implementation of the JmsProviderMarshaler interface.

To create a custom provider marshaler, you implement the org.apache.servicemix.jms.endpoints.JmsProviderMarshaler interface. The JmsProviderMarshaler interface, shown in Example 6.4, has two methods you need to implement:


createMessage()

The createMessage() method uses information from the FUSE ESB 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 FUSE ESB core.

Example 6.5 shows a simple provider marshaler implementation.


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 6.6 shows configuration for a provider that uses a custom marshaler.


[Note]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.