public class DefaultMessageCollection extends DefaultMuleMessage implements MuleMessageCollection
MuleMessage type that manages a collection of MuleMessage Objects.
Typically this type of message is only used when users explicitly want to work with aggregated or re-sequenced
collections of messages.
Note that the DefaultMuleMessage.getPayload() for this message will return a List of payload objects for
each of the Mule messages stored in this collection.
Calling MuleMessage.getPayload(Class) will attempt to transform all payloads and return a List.
The methods MuleMessage.getPayloadAsString() and MuleMessage.getPayloadAsBytes() are unsupported, instead users should
call MuleMessage.getPayload(Class) and pass in the return type byte[].class or String.class.DefaultMuleMessage.SerializedDataHandlerThreadSafeAccess.AccessControlDeserializationPostInitialisable.ImplementationmuleContext, NOT_SETREAD, WRITE| Constructor and Description |
|---|
DefaultMessageCollection(DefaultMessageCollection msg,
MuleContext muleContext)
Performs a shallow copy
|
DefaultMessageCollection(DefaultMessageCollection msg,
MuleContext muleContext,
boolean deepMessageCopy)
Performs a shallow or deep copy of the messages
|
DefaultMessageCollection(MuleContext muleContext) |
| Modifier and Type | Method and Description |
|---|---|
void |
addMessage(MuleMessage message) |
void |
addMessage(MuleMessage message,
int index) |
void |
addMessages(List<MuleMessage> messages) |
void |
addMessages(MuleEvent[] events) |
void |
addMessages(MuleMessage[] messages) |
protected void |
checkValidPayload() |
MuleMessage |
createInboundMessage()
Copy an inbound message to an outbound one, moving all message properties and attachments
|
MuleMessage |
getMessage(int index) |
protected List<MuleMessage> |
getMessageList() |
MuleMessage[] |
getMessagesAsArray() |
Object |
getPayload(Class outputType)
Applies the
MuleMessage.getPayload(Class) call to every message in the collection and returns a
List of results. |
byte[] |
getPayloadAsBytes()
Converts the message implementation into a byte array representation
|
String |
getPayloadAsString(String encoding)
Converts the message implementation into a String representation
|
String |
getPayloadForLogging()
Get the message payload for logging without throwing exception
Converts the message implementation into a String representation.
|
String |
getPayloadForLogging(String encoding)
Get the message payload for logging without throwing exception
Converts the message implementation into a String representation.
|
protected List<Object> |
getPayloadList() |
Object[] |
getPayloadsAsArray() |
boolean |
isInvalidatedPayload() |
ThreadSafeAccess |
newThreadCopy()
We need to overload this if we find we want to make this class available to users, but the copy will be expensive;
|
void |
removedMessage(MuleMessage message) |
void |
setPayload(Object payload)
Update the message payload.
|
int |
size() |
addAttachment, addInboundAttachment, addInboundProperties, addOutboundAttachment, addOutboundAttachment, addProperties, addProperties, applyAllTransformers, applyTransformers, applyTransformers, applyTransformers, assertAccess, clearAttachments, clearProperties, clearProperties, copyMessageProperties, copyToInbound, equals, findPropertyInAnyScope, findPropertyInSpecifiedScopes, getAttachment, getAttachmentNames, getBooleanProperty, getCorrelationGroupSize, getCorrelationId, getCorrelationSequence, getDataType, getDoubleProperty, getEncoding, getExceptionPayload, getInboundAttachment, getInboundAttachmentNames, getInboundProperty, getInboundProperty, getInboundPropertyNames, getIntProperty, getInvocationProperty, getInvocationProperty, getInvocationPropertyNames, getLongProperty, getMessageRootId, getMuleContext, getOriginalPayload, getOrphanFlowVariables, getOutboundAttachment, getOutboundAttachmentNames, getOutboundProperty, getOutboundProperty, getOutboundPropertyNames, getPayload, getPayload, getPayload, getPayloadAsString, getProperty, getProperty, getProperty, getProperty, getPropertyDataType, getPropertyNames, getPropertyNames, getReplyTo, getSessionProperty, getSessionProperty, getSessionPropertyNames, getStringProperty, getUniqueId, hashCode, initAfterDeserialisation, isConsumable, isDisabled, isPayloadConsumed, newException, propagateRootId, release, removeAttachment, removeOutboundAttachment, removeProperty, removeProperty, resetAccessControl, setBooleanProperty, setCorrelationGroupSize, setCorrelationId, setCorrelationSequence, setDataType, setDoubleProperty, setEncoding, setExceptionPayload, setInboundProperty, setInboundProperty, setIntProperty, setInvocationProperty, setInvocationProperty, setLongProperty, setMessageRootId, setMimeType, setMuleContext, setOutboundProperty, setOutboundProperty, setPayload, setProperty, setProperty, setProperty, setReplyTo, setSessionProperty, setStringProperty, setUniqueId, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddAttachment, addOutboundAttachment, addOutboundAttachment, addProperties, addProperties, applyTransformers, applyTransformers, applyTransformers, clearAttachments, clearProperties, clearProperties, findPropertyInAnyScope, getAttachment, getAttachmentNames, getBooleanProperty, getCorrelationGroupSize, getCorrelationId, getCorrelationSequence, getDataType, getDoubleProperty, getEncoding, getExceptionPayload, getInboundAttachment, getInboundAttachmentNames, getInboundProperty, getInboundProperty, getInboundPropertyNames, getIntProperty, getInvocationProperty, getInvocationProperty, getInvocationPropertyNames, getLongProperty, getMessageRootId, getMuleContext, getOriginalPayload, getOutboundAttachment, getOutboundAttachmentNames, getOutboundProperty, getOutboundProperty, getOutboundPropertyNames, getPayload, getPayload, getPayloadAsString, getProperty, getProperty, getProperty, getProperty, getPropertyDataType, getPropertyNames, getPropertyNames, getReplyTo, getSessionProperty, getSessionProperty, getSessionPropertyNames, getStringProperty, getUniqueId, propagateRootId, release, removeAttachment, removeOutboundAttachment, removeProperty, removeProperty, setBooleanProperty, setCorrelationGroupSize, setCorrelationId, setCorrelationSequence, setDoubleProperty, setEncoding, setExceptionPayload, setIntProperty, setInvocationProperty, setInvocationProperty, setLongProperty, setMessageRootId, setOutboundProperty, setOutboundProperty, setPayload, setProperty, setProperty, setProperty, setReplyTo, setSessionProperty, setStringPropertypublic DefaultMessageCollection(MuleContext muleContext)
public DefaultMessageCollection(DefaultMessageCollection msg, MuleContext muleContext)
msg - muleContext - public DefaultMessageCollection(DefaultMessageCollection msg, MuleContext muleContext, boolean deepMessageCopy)
msg - muleContext - deepMessageCopy - protected void checkValidPayload()
public void addMessage(MuleMessage message)
addMessage in interface MuleMessageCollectionpublic MuleMessage[] getMessagesAsArray()
getMessagesAsArray in interface MuleMessageCollectionpublic Object[] getPayloadsAsArray()
getPayloadsAsArray in interface MuleMessageCollectionpublic void removedMessage(MuleMessage message)
removedMessage in interface MuleMessageCollectionpublic void addMessage(MuleMessage message, int index)
addMessage in interface MuleMessageCollectionpublic void addMessages(MuleEvent[] events)
addMessages in interface MuleMessageCollectionpublic void addMessages(List<MuleMessage> messages)
addMessages in interface MuleMessageCollectionpublic void addMessages(MuleMessage[] messages)
addMessages in interface MuleMessageCollectionpublic MuleMessage getMessage(int index)
getMessage in interface MuleMessageCollectionprotected List<MuleMessage> getMessageList()
public void setPayload(Object payload)
DefaultMuleMessagesetPayload in interface MuleMessagesetPayload in class DefaultMuleMessagepayload - the object to assign as the message payloadpublic Object getPayload(Class outputType) throws TransformerException
MuleMessage.getPayload(Class) call to every message in the collection and returns a
List of results.
Will attempt to obtain the payload of this message with the desired Class type. This will
try and resolve a transformer that can do this transformation. If a transformer cannot be found
an exception is thrown. Any transformers added to the registry will be checked for compatibilitygetPayload in interface MuleMessagegetPayload in class DefaultMuleMessageoutputType - the desired return typeTransformerException - if a transformer cannot be found or there is an error during transformation of the
payloadpublic int size()
size in interface MuleMessageCollectionpublic byte[] getPayloadAsBytes()
throws Exception
getPayloadAsBytes in interface MuleMessagegetPayloadAsBytes in class DefaultMuleMessageException - Implemetation may throw an endpoint specific exceptionpublic String getPayloadAsString(String encoding) throws Exception
getPayloadAsString in interface MuleMessagegetPayloadAsString in class DefaultMuleMessageencoding - The encoding to use when transforming the message (if
necessary). The parameter is used when converting from a byte arrayException - Implementation may throw an endpoint specific exceptionpublic String getPayloadForLogging(String encoding)
getPayloadForLogging in interface MuleMessagegetPayloadForLogging in class DefaultMuleMessagepublic String getPayloadForLogging()
getPayloadForLogging in interface MuleMessagegetPayloadForLogging in class DefaultMuleMessagepublic ThreadSafeAccess newThreadCopy()
newThreadCopy in interface ThreadSafeAccessnewThreadCopy in class DefaultMuleMessagepublic MuleMessage createInboundMessage() throws Exception
createInboundMessage in interface MuleMessagecreateInboundMessage in class DefaultMuleMessageExceptionpublic boolean isInvalidatedPayload()
Copyright © 2003–2015 MuleSoft, Inc.. All rights reserved.