Interface Message<T>

All Superinterfaces:
Serializable

public interface Message<T> extends Serializable
Abstract message representation, the default implementation is an XML based message, that can be created via XMLMessageFactory.getInstance().createMessage
  // create a std dom parser
  DOMParser parser = new DOMParser();
  parser.parse(new InputSource(new StringReader(xml)));
 
  Element element = parser.getDocument().getDocumentElement();
  Map <String, Element> payload = new HashMap<String, Element>();
  payload.put(<payload part name>, element);
  Message<Element> xmlMessage = 
       XMLMessageFactory.getInstance().createMessage(payload);
 
  • Method Details

    • setPayload

      void setPayload(Payload<T> payload)
      Specifies the payload associated with the message
      Parameters:
      payload - the payload of the message.
    • getPayload

      Payload<T> getPayload()
      Gets the message payload
      Returns:
      The message payload
    • addAttachment

      void addAttachment(Attachment attachment)
      Adds a message attachment
      Parameters:
      attachment - an attachment
    • getAttachments

      List<Attachment> getAttachments()
      Gets the message attachments
      Returns:
      The message attachments
    • addHeader

      void addHeader(Element header)
      Adds a protocol header to the message
      Parameters:
      header - the header
    • setHeaders

      void setHeaders(List<Element> headers)
      Replaces the current set of protocol headers with the specified set
      Parameters:
      headers - the replacement headers
    • getHeaders

      List<Element> getHeaders()
      Gets the protocol headers
      Returns:
      The protocol headers
    • setProperties

      void setProperties(Map<String,Object> properties)
      Replaces all existing properties on the message with the specified set
      Parameters:
      properties - the replacement properties
    • getProperties

      Map<String,Object> getProperties()
      Gets the message properties
      Returns:
      The message properties
    • setProperty

      void setProperty(String name, Object value)
      Sets a specific property on the message
      Parameters:
      name - the name of the property
      value - the value of the named property
    • getProperty

      Object getProperty(String name)
      Gets the specified message property value
      Parameters:
      name - the property name
      Returns:
      The value of the specified property