While adaptors carry messages throughout the components,
they also fill and get access to a dictionnary of data. A dictionnary
is a Python type that is also known as Hash table in Java.
It is some kind of a table, whose indexes are strings instead
of integers.
Let's say you extract rows from database tables
which are to be sent to different email addresses, but, those
addresses are inside these rows. After extracting it from the
SQLSource, an XPathMetadataPipe permits
to extract the address from the XML representation in the dictionnary,
with an XPath query.
Metadatas can be called in the adaptor definition
using the following notation : [[MetadataName]]
So let's say I'm using an SQLSource, executing the following query :
Select data1, data2, data3, emailAddress from myTable
The source will output something that looks like this (well if you choose xml as output format) :
<?xml version="1.0" encoding="UTF-8"?>
<rootTag>
+++<recTag>
++++++ <data1>valueOfData1</data1>
++++++ <data2>valueOfData2</data2>
++++++ <data3>valueOfData3</data3>
++++++ <emailAddress>myEmail@myProvider.com</emailAddress>
+++</recTag>
+++<recTag>
++++++...
</rootTag>
If you define the following XPathMetadataPipe :
<pipe name="XPathMetadata2" type="XPathMetadata">
+++<params name="params2" type="params">
++++++<param name="emailAddress" type="param" paramType="" value="/rootTag/recTag/emailAddress"/>
+++</params>
</pipe>
You'll extract the value of the first occurence of the /rootTag/recTag/emailAddress tag into the metadata dictionnary under the name 'emailAddress'.
Then, to send the extracted rows by mail (even if they were transformed meanwhile by another pipe - XSLT for example), define an SMTP sink with [[emailAddress]] as value of the "to" attribute (which corresponds to the recipient address).
The XPath pipe can help by splitting the recTag tags into separate messages.