The MessageParsingService provides a mechanism for components to retrieve loaded message definitions, and to parse messages. The parsing service provides an internal cache of parsed messages, thereby allowing Rhapsody to avoid parsing messages multiple times when this is not necessary.

Method Description

LoadedDefinition getLoadedDefinition(Definition definition)

Retrieves a loaded message definition ready for use, from the specified definition.

Parameters:

  • definition - the definition to be loaded.

Exceptions:

  • DefinitionException - if an error occurs loading the definition. 

LoadedDefinition getLoadedDefinition(Definition definition, LoadedDefinitionKey key)

Retrieves a loaded message definition ready for use, from the specified definition.

Parameters:

  • definition - the definition to be loaded.
  • key - a discriminator to be used to enable multiple loadings of the same definition, passing null will be the same as calling getLoadedDefinition(Definition).

Exceptions:

  • DefinitionException - if an error occurs loading the definition. 

MessageFormatFactory getMessageFormatFactory()

Retrieves the message format factory for this environment. Message formats allow messages to be parsed and processed without the filters or communication points knowing how the messages are parsed.

saveParsedMessage(Message message, MessageXPathContext context)

Method returns the parsed message body to the service, allowing the message parsing service to utilize its cache. Returning the parsed message bodies to the cache greatly improves the performance of Rhapsody. If any changes were made to the parsed body, the changes are parsed-out to the persistence store, updating the message object itself.

This method should not be called if changes have been made to the message context while those changes should not be saved. However, it should be called when no changes are made (or if the changes should be saved) as this allows reuse of the parsed bodies.

Parameters:

  • message - the message whose parsed body is being returned. If this parameter is null, unmodified message contexts are returned to the cache for re-use by other messages, and other contexts are discarded.
  • context - the parsed message body.

Exceptions:

  • MessageException - if an error occurs writing out the message body, when saving a modified parsed message.
  • InterruptedException - when a thread is waiting, sleeping, or otherwise occupied, and the thread is interrupted, either before or during the activity.

setMessageFormat(Message message, MessageFormat messageFormat, String messageName)

Marks this message as being most recently parsed using the specified message format with the specified message name. This means that the specified message format is then preferred when the message next needs to be parsed and no specific message format is provided. This method does not need to be called if the MessageFormat was actually used to parse the message as it is set automatically in that case.

It is primarily intended for filters that modify the message body and are aware of what the new message format is (for example, the Mapper filter). If the message name is null, then the existing message name in the StandardMessageProperty.OUTPUT_MESSAGE_TYPE property is left unchanged. If the message name is an empty string, then the existing message name is cleared. Otherwise, the StandardMessageProperty.OUTPUT_MESSAGE_TYPE property is updated with the new message name.

Parameters:

  • message - the message.
  • messageFormat - the message format.
  • messageName - the new message name.

Exceptions:

  • NullPointerException - if either message or messageFormat is null.

Save

Save