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
<mix name="Mix">
  <service name="Expr"  
    provision="expr"/>  
  <request name="FirstDivisor"  
    service="Expr"  
    fields="TEST">    
    <prop name="expr.src"
      content-type="text/x-erlang"><![CDATA[
  put("div", 2),
  "Ok".  
    ]]></prop>    
    <reply name="Ok"    
      fields="div"/>
  </request>
</mix>
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 used to populate the div field sent in the reply.