Subroutines pattern
Subroutines can be used to construct a complex mix. A request or consume operation of a mix can be matched to another solicit or notify operation that starts a subroutine transaction.
In the example in Table 1, there are two mixes, both in the same configuration tree. A request/reply calls on a subroutine transaction.
Example | Description |
---|---|
<folder name="Folder"> <service name="Subr" provision="subr"/> <mix name="Mix"> <field name="a" type="string"/> <field name="b" type="integer"/> <request name="myRequest" fields="a" service="Subr"> <prop name="subr.spec" function="MyFun"/> <prop name="params"><![CDATA[ param1:a ]]></prop> <reply name="Ok" fields="b"> <prop name="params"><![CDATA[ param2:b ]]></prop> </reply> </request> </mix> <mix name="Mix2"> <field name="x" type="string"/> <field name="y" type="integer"/> <solicit name="mySolicit" clients="Subr" fields="x" service="Sequencer"> <prop name="subr.spec" function="MyFun"/> <prop name="params"><![CDATA[ param1:x ]]></prop> <response name="Ok" fields="y"> <prop name="params"><![CDATA[ param2:y ]]></prop> </response> </solicit> </mix> </folder> |
The request/reply can call on the subroutine solicit/response, that starts a subroutine
transaction, because:
|