@ComponentProfile(summary="Aggregator implementation that creates a new mime part for each message that needs to be joined up") public class MimeAggregator extends MessageAggregatorImpl
MessageAggregator
implementation that creates a new mime part for each message that needs to be joined up.
The pre-split message is always treated as the first part of the resulting multipart message; the payloads from the split
messages form the second and subsequent parts. If the split message contains a specific metadata key (as configured by
setPartContentIdMetadataKey(String)
) then the corresponding value will be used as that parts Content-Id
. If
the metadata key does not exist, or is not configured, then the split message's unique-id will be used. If the same
Content-Id
is observed for multiple split messages then results are undefined. The most likely situation is that
parts will be lost and only one preserved.
Note that the first part's Content-Id
will always be the original messages unique-id. Also, if the original message
was a Multipart message, then this will be added as a single part to the resulting multipart message (giving you a nested
multipart as the first part).
As a result of this join operation, the message will be marked as MIME encoded using CoreConstants.MSG_MIME_ENCODED
metadata.
CoreConstants.MSG_MIME_ENCODED
In the adapter configuration file this class is aliased as mime-aggregator which is the preferred alternative to the fully qualified classname when building your configuration.
filterCondition, log, retainFilterExceptionsMessages
Constructor and Description |
---|
MimeAggregator() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
contentId(AdaptrisMessage msg) |
protected java.lang.String |
contentType(AdaptrisMessage msg) |
protected javax.mail.internet.MimeBodyPart |
createBodyPart(AdaptrisMessage msg) |
protected MultiPartOutput |
createInitialPart(AdaptrisMessage original) |
java.lang.String |
getEncoding() |
java.lang.String |
getMimeContentSubType() |
MetadataFilter |
getMimeHeaderFilter() |
java.lang.String |
getPartContentId() |
java.lang.String |
getPartContentIdMetadataKey()
Deprecated.
since 3.9.0; use an expression based part-content-id instead
|
java.lang.String |
getPartContentType() |
java.lang.String |
getPartContentTypeMetadataKey()
Deprecated.
since 3.9.0 use an expression based part-content-type instead
|
MetadataFilter |
getPartHeaderFilter() |
void |
joinMessage(AdaptrisMessage original,
java.util.Collection<AdaptrisMessage> messages)
Joins multiple
AdaptrisMessage s into a single AdaptrisMessage objects. |
protected java.lang.String |
mimeContentSubType(AdaptrisMessage msg) |
protected MetadataFilter |
mimeHeaderFilter() |
protected MetadataFilter |
partHeaderFilter() |
void |
setEncoding(java.lang.String s)
Set the encoding to be used for the content.
|
void |
setMimeContentSubType(java.lang.String s) |
void |
setMimeHeaderFilter(MetadataFilter filter)
Set a metadata filter which be applied to generate the root level mime headers.
|
void |
setPartContentId(java.lang.String s)
Set the content type for each part.
|
void |
setPartContentIdMetadataKey(java.lang.String s)
Deprecated.
since 3.9.0; use an expression based part-content-id instead
|
void |
setPartContentType(java.lang.String s)
Set the content-type for each part.
|
void |
setPartContentTypeMetadataKey(java.lang.String s)
Deprecated.
since 3.9.0 use an expression based part-content-type instead
|
void |
setPartHeaderFilter(MetadataFilter filter)
Set a metadata filter which will be applied to generate headers for each part.
|
<T extends MimeAggregator> |
withEncoding(java.lang.String s) |
<T extends MimeAggregator> |
withMimeContentSubType(java.lang.String s) |
<T extends MimeAggregator> |
withMimeHeaderFilter(MetadataFilter filter) |
<T extends MimeAggregator> |
withPartContentId(java.lang.String s) |
<T extends MimeAggregator> |
withPartContentType(java.lang.String s) |
<T extends MimeAggregator> |
withPartHeaderFilter(MetadataFilter filter) |
filter, filter, getFilterCondition, getOverwriteMetadata, getRetainFilterExceptionsMessages, overwriteMetadata, overwriteMetadata, retainFilterExceptionsMessages, setFilterCondition, setOverwriteMetadata, setRetainFilterExceptionsMessages, withOverwriteMetadata
public void joinMessage(AdaptrisMessage original, java.util.Collection<AdaptrisMessage> messages) throws CoreException
MessageAggregator
Joins multiple AdaptrisMessage
s into a single AdaptrisMessage objects. Preservation of metadata is down to the
implementation.
original
- the msg to insert all the messages intomessages
- the list of messages to join.CoreException
- wrapping any other exceptionprotected javax.mail.internet.MimeBodyPart createBodyPart(AdaptrisMessage msg) throws javax.mail.MessagingException, java.io.IOException
javax.mail.MessagingException
java.io.IOException
protected MultiPartOutput createInitialPart(AdaptrisMessage original) throws javax.mail.MessagingException, java.io.IOException
javax.mail.MessagingException
java.io.IOException
public java.lang.String getEncoding()
public void setEncoding(java.lang.String s)
s
- the encoding to set, defaults to no-encoding (null)@Deprecated @Removal(version="3.11.0", message="use an expression based part-content-id instead") public java.lang.String getPartContentIdMetadataKey()
@Deprecated @Removal(version="3.11.0", message="use an expression based part-content-id instead") public void setPartContentIdMetadataKey(java.lang.String s)
s
- the partContentIdMetadataKey to set@Deprecated @Removal(version="3.11.0", message="use an expression based part-content-type instead") public java.lang.String getPartContentTypeMetadataKey()
@Deprecated @Removal(version="3.11.0", message="use an expression based part-content-type instead") public void setPartContentTypeMetadataKey(java.lang.String s)
s
- the partContentTypeMetadataKey to setpublic java.lang.String getMimeContentSubType()
public void setMimeContentSubType(java.lang.String s)
public java.lang.String getPartContentId()
public void setPartContentId(java.lang.String s)
s
- the content id; supports the %message{}
syntax to resolve metadata.public java.lang.String getPartContentType()
public void setPartContentType(java.lang.String s)
s
- the content-type; supports the %message{}
syntax to resolve metadata.public MetadataFilter getPartHeaderFilter()
public void setPartHeaderFilter(MetadataFilter filter)
filter
- the filter; defaults to RemoveAllMetadataFilter
if not
specified.public MetadataFilter getMimeHeaderFilter()
public void setMimeHeaderFilter(MetadataFilter filter)
filter
- public <T extends MimeAggregator> T withPartHeaderFilter(MetadataFilter filter)
public <T extends MimeAggregator> T withMimeHeaderFilter(MetadataFilter filter)
public <T extends MimeAggregator> T withMimeContentSubType(java.lang.String s)
public <T extends MimeAggregator> T withPartContentId(java.lang.String s)
public <T extends MimeAggregator> T withPartContentType(java.lang.String s)
public <T extends MimeAggregator> T withEncoding(java.lang.String s)
protected MetadataFilter partHeaderFilter()
protected MetadataFilter mimeHeaderFilter()
protected java.lang.String mimeContentSubType(AdaptrisMessage msg)
protected java.lang.String contentType(AdaptrisMessage msg)
protected java.lang.String contentId(AdaptrisMessage msg)