The Subroutine extension

The svc_subr extension makes it possible to have controlling mixes that can invoke transactions in other mixes, where those other transactions have matching signatures.

The subroutine specification is made in the subr.spec property.

The following matchings are possible:
  1. Consume matched to notify
  2. Request/reply matched to solicit/response
  3. Consume/reply matched to solicit/response

In the case of option 2 and 3, the number and name of replies should match the number and name of the responses.

The fields can be parameterised. For example a reply field can be matched to a response field even if they have a different name. The caller operation must include all the parameter names required by the called operation.

Important: If the parameterised fields are not of the same type, the value is cast using the sse_type_util:coerece/2 function.

Matching of caller with called operation can be done within the user's configuration tree, or between user configuration trees. Foreign matchings are implemented by key-based matchings between services.

The Subroutine extension makes the following patterns possible:
Subroutines
Same-service subroutines used to factor complex mixes.
Modules
Different-service subroutines, optionally located under foreign username, and imported using a key.
Multicasts
Consume operations calling on multiple notify subroutines. When a consume, supported by a svc_subr service, is invoked, it fires all subroutine notifies on that same service.
Widgets
Possibly identical subroutines distinguished by where they're loaded in a template mix.
Libraries
Subroutines grouped by being on the same svc_subr client. Keys differentiate between the clients.
Filtered subroutines
Subroutines filtered by Erlang expressions used as predicates. Filtered subroutines only fire if their predicates evaluate to true.