11.6. Using Mime Decoders in Gateway Implementations

The easiest way to make a MessageComposer use the installed mime decoders is via the ConfigTree and the MimeDecoder.Factory class factory method:
this.mimeDecoder = MimeDecoder.Factory.getInstanceByConfigTree(config);
This relies on the listener configuration specifying either the “mimeType” or “mimeDecoder” configuration properties (as supported by the File and FTP listeners):
<fs-listener name="FileGateway1" busidref="fileChannel1" is-gateway="true" 
    <property name="mimeType" value="text/plain" />
    <property name="encoding" value="UTF-8" />
<fs-listener name="FileGateway2" busidref="fileChannel2" is-gateway="true" 
    <property name="mimeDecoder" value="com.acme.mime.ImageJPEGMimeDecoder” />
To perform the actual decoding of the transport payload, the MessageComposer instance utilizes the decode method on its mimeDecoder instance:
Object decodedPayload = mimeDecoder.decode(payloadBytes);
It then sets the “decodedPayload” Object instance on the message instance being composed.