newton
Newton
 

Presence Patterns

Presence is an implementation of the RuntimeActivationGuard pattern in Newton. It is used to implement behaviours such as fast failover strategies though mechanisms such as active passive and buddy.

Active Passive

This strategy is used to ensure that a specified number of composite are active and another number is passive. A passive composite is activated if an active composite is lost (for example due to failure or administrative intervention).

The implementation used in Newton uses the concept of absolute time (as measured from the system clock of the machine on which the Newton process is running) of install to decide which composites are active. The composites that were installed first are activated and others remain passive.

Absolute time is used because it ensures stability in the fabric, other schemes such as a random or merit based schemes can also work but are prone to phases of instability – a new newton process may start up which effectively “usurps” control from existing composites. Note in some scenarios this may be desirable, likely hood is we will support some of these patterns in the relatively near future.

Example

Within an SCA composite specify the following xml elements:

<presence-group labels="myPresenceGroup" strategy="org.cauldron.newton.presence.strategy.ActivePassiveStrategy">
<property name="maximumActive" value="1" type="integer" />
</presence-group>

This specifies that a maximum of one composite should be active at any one time, all other installs will be in a passive state until the primary is uninstalled or lost.

Buddy

The buddy strategy links the activation of one composite to that of another, if one composite is activated so is the other, if the parent composite is deactivated so is the other. This allows for simple chaining of activation/deactivation life-cycles between components.

Example

Within an SCA composite specify the following xml elements:

<presence-group strategy="org.cauldron.newton.presence.strategy.BuddyStrategy">
<property name="buddy" value="myPresenceGroup" type="string" />
</presence-group>

This specifies that the composite is buddied to any composites which declare the label myPresenceGroup, if they activate, then this composite will activate.

Note
By default this only applies to composites in the same Newton process. If you wish to buddy your composite to one potentially installed in another Newton process add the configuration property localOnly=false (type boolean)