### *** This class provides Binary Compatibility only, not Source Compatibility ***

Package com.sas.services.events.broker

# Class MessageFactory

java.lang.Object
com.sas.services.events.broker.MessageFactory

@SASScope("ALL") @BinaryCompatibilityOnly public class MessageFactory extends Object
This class produces `Event Broker service` `messages` that can be used within `process nodes` to create new messages in order to propagate them to other downstream process nodes within a process flow for further processing.

## Usage

Use this class within a process node to generate new messages.

Since:
  1.0

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `MESSAGE_FLAG_EMPTY_BODY`
  Create a message with an empty body.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MessageFactory()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `MessageInterface`
  `newMessage()`
  Create a new message with an empty body.
  `MessageInterface`
  `newMessage(MessageInterface message, int flags)`
  Create a new message based on an existing message.
  `MessageInterface`
  `newMessage(Object body)`
  Create a new message with the specified body.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### MESSAGE_FLAG_EMPTY_BODY

    public static final int MESSAGE_FLAG_EMPTY_BODY
    Create a message with an empty body.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### MessageFactory

    public MessageFactory()

- ## Method Details

  - ### newMessage

    public MessageInterface newMessage()
    Create a new message with an empty body.
    Returns:
      generated message.
    See Also:
      - `MessageInterface`

  - ### newMessage

    public MessageInterface newMessage(Object body)
    Create a new message with the specified body.
    Parameters:
      `body` - message body.
    Returns:
      generated message.
    See Also:
      - `MessageInterface`

  - ### newMessage

    public MessageInterface newMessage(MessageInterface message, int flags)
    Create a new message based on an existing message.

    This is identical to `cloning`.

    If the body of the existing message is a DOM node, the new message will be created with the same owning Document. That is, the new message will have the same DOM Document owner as the existing message. Having the same owning Document, allows DOM nodes to copy (append/insert) to and from each other. Otherwise, when nodes belong to different documents, they must first be imported into a document before they can be used.

    Using this method will also ensure that other message attributes are carried forward such as the associated event name and security context.

    Additionally, you can specify the following information:

    - whether or not to set the body to `empty`.

    When setting a message body to empty, the new message body is saved as an empty string object unless the existing message body is a DOM node. In that case, a new empty DOM node (DocumentFragement) is created from the existing message's owning document.

    Parameters:
      `message` - existing message to copy from.
      `flags` - additional information about how to create this message.
    Returns:
      generated message.
    See Also:
      - `MessageInterface`