08.06.2014 Views

Download PDF (1.3 MB) - IBM Redbooks

Download PDF (1.3 MB) - IBM Redbooks

Download PDF (1.3 MB) - IBM Redbooks

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

through the synchronous SCA binding on each transaction, it is better to set modules A and B<br />

to both use either eager parsing or lazy parsing.<br />

The interaction between modules with different parsing modes takes place through<br />

serialization and deserialization, which can negatively affect performance. If using a mixed<br />

mode is unavoidable, starting an application from an eager parsing module to a lazy parsing<br />

module is more efficient than the other way around. The output from the eager parsing<br />

module is serialized into an XML string, and the target module using lazy parsing still benefits<br />

fully from delayed parsing, producing this efficiency.<br />

Share-by-reference libraries<br />

Lazy parsing is optimized to use share-by-reference libraries. When a BO travels from one<br />

module to another as a parameter of a synchronous SCA service invocation, a lazy copy is<br />

used if the source and target modules share the BO schema through a share-by-reference<br />

library. Without the share-by-reference optimization, the caller serializes the BO and the<br />

callee deserializes the BO.<br />

Differences in behavior for lazy parsing and eager parsing<br />

If you are changing an application that was originally developed with eager parsing to use<br />

lazy parsing, be aware of the differences in behavior between each mode, as summarized<br />

here. Also consider the behavior differences between each node if you are planning to switch<br />

an application between lazy and eager parsing mode.<br />

Error handling<br />

If the XML byte stream being parsed is ill-formed, parsing exceptions occur:<br />

►<br />

►<br />

With eager parsing, the exceptions occur as soon as the BO is parsed from the inbound<br />

XML stream.<br />

With lazy parsing, the parsing exceptions occur latently when the application accesses the<br />

BO properties and parses the portion of the XML that is ill-formed.<br />

To properly handle ill-formed XML for either parsing mode, select one of the following options:<br />

► Deploy a Mediation Flow Component on the application edges to validate inbound XML.<br />

► Author lazy error-detection logic at the point where BO properties are accessed.<br />

Exception stacks and messages<br />

Because eager and lazy parsing have different underlying implementations, stack traces that<br />

are generated by the BO programming interfaces and services have the same exception<br />

class name. However, stack traces might not contain the same exception message or<br />

wrapped set of implementation-specific exception classes.<br />

XML serialization format<br />

Lazy parsing provides a fast serialization optimization that attempts to copy unmodified XML<br />

from the inbound data stream to the outbound data stream upon serialization. The fast<br />

serialization improves performance, but the resultant serialization format of the outbound<br />

XML data stream might be syntactically different than if the entire BO is updated in lazy<br />

parsing, or if eager parsing is used.<br />

The output XML serialization format might not be precisely syntactically equivalent across<br />

these cases. However, the semantics of the XML data streams are equivalent, regardless of<br />

the parsing mode, and the resultant XML can be safely passed between applications running<br />

in different parsing modes with semantic equivalence.<br />

Chapter 3. Development best practices 33

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!