Handling
Large Messages with Content Streaming
OSB supports the streaming of content through the service
bus and also supports streaming transformations. Content streaming is enabled
by simply selecting the Enabled check box during proxy service definition
The following are
some of the best practices related to streaming content:
Enable streaming
for pure content-based routing scenarios. Read-only scenarios
such as content-based routing can gain significantly from enabling streaming.
OSB leverages the partial parsing capabilities of the XQuery engine when
streaming is used in conjunction with indexed XPaths. Thus, the payload is
parsed and processed only to the field referred to in the XPath. Other than
partial parsing, an additional benefit for read-only scenarios is that
streaming eliminates the overhead associated with parsing and serialization of
XMLBeans.
Enable streaming
if there is an out-of-memory error when transforming large messages.
The output of a transformation is stored in a compressed
buffer format either in memory or on disk. Using a compressed buffer format has
a significant CPU penalty. Hence, when running out of memory is not a
concern, streaming with compressed buffering should beavoided.
Use a hybrid
approach for multiple reads with streaming.
The gains from streaming can be negated if the payload is
accessed a large number of times for reading multiple fields. If all fields
read are located in a single subsection of the XML document, a hybrid approach provides
the best performance. The hybrid approach includes enabling streaming at the proxy
level and assigning the relevant subsection to a context variable
For example, the fields Total and Status from the Below XML
can be retrieved from a fully materialized subsection Summary:
****************************************************************
<soap-env:Body>
<Order>
<CtrlArea>
<CustName>Mary</CustName>
</CtrlArea>
<ItemList>
<Item name="ACE_Car"
>20000 </Item>
<Item
name=" Ext_Warranty" >1500</Item>
.... a large
number of items
</ItemList>
<Summary>
<Total>70000</Total>
<Status>Shipped</Status>
<Shipping>My
Shipping Firm </Shipping>
</Summary>
</Order>
</soap-env:Body>
****************************************************************
Assign
"$body/Order[1]/Summary[1]" to "summary"
Assign
"$summary/Total" to "total"
Assign
"$summary /Status" to "status"