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.9.3. Message Composition
9.3.1. Message Composers Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
A MessageComposer composes or decomposes a native binding message to or from SwitchYard's canonical message. It does so in three steps:
- Construct a new target message instance.
- Copy the content of the message.
- Delegate the header/property mapping to a ContextMapper.
A SOAPMessageComposer and CamelMessageComposer are included with SwitchYard. These implementations are used by their associated bindings but you can override these with your own implementations.
9.3.2. Create a Custom Message Composer Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
Procedure 9.2. Create a Custom Message Composer
- Implement the
org.switchyard.component.common.composer.MessageComposer
interface:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Specify your implementation in your
switchyard.xml
file:<binding.xyz ...> <messageComposer class="com.example.MyMessageComposer"/> </binding.xyz>
<binding.xyz ...> <messageComposer class="com.example.MyMessageComposer"/> </binding.xyz>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
9.3.3. Custom Message Composer Properties Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
- The
getContextMapper()
andsetContextMapper()
methods are bean properties. If you extend BaseMessageComposer, both properties are implemented for you. - Your
compose()
method needs to take the data from the passed-in source native message and compose a SwitchYard Message based on the specified Exchange. The create parameter determines whether or not we ask the Exchange to create a new Message, or use the existing one. - Your
decompose()
method needs to take the data from the SwitchYard Message in the specified Exchange and "decompose it" into the target native message.