This page describes how to use the Multi-Payload Adaptris Message

New Message Type and Factory

Multi-Payload Adaptris Message

The Multi-Payload Adaptris Message is a new message type that supports having multiple payloads in a single message. Each payload can be accessed by its user-defined ID.

Multi-Payload Message Factory

The Multi-Payload Message Factory is the standard way to create a new multi-payload capable message. It can be used instead of the default message factory, with the option of setting the default payload ID.

   <message-factory class="multi-payload-message-factory">

New Services

Add Payload

The Add Payload Service allows for a new payload to be added to an existing multi-payload message. The service allows for the new payload to originate from any Data Input Parameter String.

        <new-payload class="file-data-input-parameter">
            <destination class="configured-destination">
                <destination><!-- path to file to include as new payload --></destination>

Switch Payload

The Switch Payload Service allows for the current working payload to be changed. This is particularly useful if the next service in the workflow only supports standard messages and the current payload isn’t the desired one.


MIME Encoder

The Multi-Payload Message MIME encoder allows for a multi-payload message to be both exported and imported, similarly to the existing MIME encoder/decoder (payload/metadata/etc). Where it differs is its ability to handle each payload as a separate MIME part. It expects the target for export and the source for import to be IO streams.

    <encoder class="com.adaptris.core.MultiPayloadMessageMimeEncoder">

Message Splitting & Joining

The Multi-Payload Message Splitter allows for a multi-payload message to be split with each of its payloads becoming a new (standard) message. This message splitter can be used wherever a message splitter is valid but does expect the original message to have multiple payloads. This will copy all metadata keys and values, therefore each split message will have identical metadata to the original.

The Multi-Payload Message Aggregator allows for a collection of messages to be merged into a single multi-payload message. The original message MUST be able to support multiple payloads. Metadata from the collections of messages is not combined so as not to accidentally overwrite values with identical keys.

Both of these need further work to properly respect the copy/combine metadata configuration options that are present in their respective parent classes.

        <service class="shared-service">
        <splitter class="multi-payload-splitter"/>
        <aggregator class="multi-payload-aggregator">

For Each

A for-each implementation that iterates over the payloads in a multi-payload message. For each payload it then executes the given service (list). By default this process is single threaded but a thread pool can be used to parallelize the loop.

            <service class="shared-service">

Data Parameters


There are three data input parameters that are multi-payload aware, and as such they require a payload ID from where to get the data. Depending on the expected data type in the payload, it can be treated as a string, a byte[] or an input stream.

  • Multi-payload string input
  • Multi-payload byte[] input
  • Multi-payload stream input


There are also three corresponding data output parameters that will write data to a new or existing payload.

  • Multi-payload string output
  • Multi-payload byte[] output
  • Multi-payload stream output

Usage Example XML

As an example of where these may be useful, see the example XML configuration below for the PGP Encrypt service (which is not multi-payload aware), but is able to reference three payload. Two for input: they public key and the plain text to encrypt; and one for streaming the encrypted cipher text out to a newly created payload.

        <public-key class="multi-payload-string-input-parameter">
        <clear-text class="multi-payload-byte-array-input-parameter">
        <cipher-text class="multi-payload-stream-output-parameter">
Tags: advanced