Widgets pattern

Widgets are identical subroutines distinguished by their position in the configuration tree.

In the example in Table 1, there are two request/reply operations that call on two identical solicit/response operations. The requests use the solicits' position to call only one of the subroutines.

Table 1. svc_subr - Widgets
Example Description
<folder name="Widgets">
  <service name="Waiter" provision="subr"/>
    <mix name="Mix">
      <request name="GetBeer" 
        fields="GET" 
        service="Waiter">
        <prop name="subr.spec"
          ancestor="Alcoholic" 
          function="FunBeer"/>
        <reply name="Ok"
         fields="beer"/>
      </request>
    </mix>

    <mix name="Alcoholic">
      <solicit name="Order"
        clients="Waiter" 
        fields="ORDER"  
        service="Sequencer">
        <prop name="subr.spec" 
          function="FunBeer"/>
        <response name="Ok" fields="drink">
          <prop name="params"><![CDATA[
beer:drink
          ]]></prop>
        </response>
      </solicit>
    </mix>

    <mix name="NonAlcoholic">  
      <solicit name="Order"
        clients="Waiter" 
        fields="ORDER"  
        service="Sequencer">
        <prop name="subr.spec" 
          function="FunBeer"/>
        <response name="Ok" fields="drink">
          <prop name="params"><![CDATA[
beer:drink
          ]]></prop>
        </response>
      </solicit>
    </mix>
  </folder>
The request/reply operation could call either solicit/response as:
  • The response names match the reply names
  • The client on the solicits matches the supporting service of the request
  • The solicits specify the same function and parameters as the request/reply

The only distinction between the two solicits is a folder that exists somewhere above them.

The ancestor attribute of the request/reply uses the folder names to differentiate between the two solicits.
Tip: Since a mix counts as a folder, it can also be used as a value for the ancestor attribute.

Without the ancestor attribute the requests would randomly call either of the identical solicit subroutines, but only one of them, as opposed to multicast notify subroutines.

In either mix containing the solicits, there can be any number of different operations that help Sequencer collect the fields expected by the responses.