Constant Operations pattern

A constant operation outputs constant values for a particular request- or consume-reply operation.

In the example in Table 1, a constant operation delivers the initial divisor 2 of any candidate prime number.

Table 1. Constant operation
Example Description
<service name="Expr"  

<request name="FirstDivisor"  

  <prop name="expr.bind.out"    

  <prop name="expr.src"
Div = 2,

  <reply name="Ok"    
Note: Do not manually type the <![CDATA...]]> delimiters. The Editor automatically renders text content as XML CDATA sections.
The service does not need a property.

The value of input fields, if they have such, is irrelevant.

The expr.src property has a list of Erlang expressions. These must be separated by commas and terminated by a full stop.

The last expression value has to name the reply set, in this case "Ok".

The value 2 is assigned to the variable Div.

Note: Variable names must start with a capital letter.

This variable is mapped to the output field with the expr.bind.out property.

Note: The example is from a version of the Primes demo using svc_expr.