WebSphere Message Broker, Version 8.0.0.7
Operating Systems: AIX, HP-Itanium, Linux, Solaris, Windows, z/OS
See information about the latest product version
See information about the latest product version
MbsMessageAssembly
The MbsMessageAssembly class represents the message assembly that is propagated between nodes in a message flow.
The message assembly comprises four individual trees:
- Message
- LocalEnvironment
- GlobalEnvironment
- ExceptionList
If assembly is an instance of MbsMessageAssembly, you can access the four component trees by using the following code:
MbsMessage message = $assembly[MB_MESSAGE];
MbsMessage local_env = $assembly[MB_LOCAL_ENVIRONMENT];
MbsMessage global_env = $assembly[MB_GLOBAL_ENVIRONMENT];
MbsMessage ex_list = $assembly[MB_EXCEPTION_LIST];
The MbsMessageAssembly class provides the API methods shown in the following table. Parameters in square brackets are optional:
Method | Description |
---|---|
Constructor(MbsMessageAssembly $assembly, MbsMessage $msg [, MbsMessage $local_env [, MbsMessage $exception_list]]) | Instantiates a new message assembly object based on the specified template assembly. The message for the assembly is replaced by the message passed in on the msg parameter. The other logical trees can also be replaced if their associated parameter is provided. If the associated parameter is not provided, the tree from the template assembly is used. |
int getType() | Returns the specific type of the root element of the message tree. |
array xpath(string $expression [, array $namespace]) | Evaluates the XPath expression with the last child of root (body element) as the context node. It returns the result as either a string, double, boolean, or a nodeset as an array of MbsElement objects. The optional namespace parameter is an associative array with namespace prefixes as the keys and namespace URIs as the values. |
MbsElement getChild(string $name [, int $occurrence]) | Returns the first child of the root element of the message tree whose name is given by the first parameter. The nth occurrence of that child can be returned by specifying the second optional parameter. |
array getChildren([string $namespace]) | Returns all the child elements of the root element of the message tree as an array of MbsElements. If the namespace parameter is specified, the array contains only the child elements with that namespace URI. |
MbsElement getFirstChild() | Returns the first child of the root element of the message tree. |
MbsElement getLastChild() | Returns the last child of the root element of the message tree. |
MbsElement addElement(string $name, object $value [, string $namespace [, int $type [, int $position]]]) | Creates an element as last child (by default)
of the root element of the message tree. The optional type parameter
is the parser-specific type of the new node (defaults to XML element
type for XML parsers). The optional position parameter
can be one of the following values:
|
MbsElement addDomainElement(string $domainName) | Creates a domain element. |
void detachAllChildren() | Detaches all child elements of the root element of the message tree. |
string asBitstream([array $options]) | Serializes the element tree to produce a bit
stream. When using the MRM parser (and other parsers), the options array
must be populated with the following key/value pairs:
|
void addElementFromBitstream(string $bitstream [, array $options]) | Creates an element tree from the supplied bit stream. Without options supplied, the bit stream is parsed by the parser of the root element of the message tree and attached as its last child (no domain element is created in this case). If options is supplied, it must contain the key/value pair 'domain' => '<parserDomain>' plus any of the additional options for the MRM parser (see asBitstream()). In this case, a parser element is created at the head of the new subtree and attached as the last child of the root element of the message tree. |
void propagate(string $terminalName) | Propagates the message assembly to the output terminal given by the parameter terminalName. |
void routeToLabel(string $labelName) | Routes the message assembly to the Label node given by the parameter labelName. |