Failover handling through object abandoment and adoption

No replies
Support
User offline. Last seen 7 weeks 3 days ago. Offline
Joined: 2010-11-26
Groups: None

Distrix provides failover capabilities through a process of object abandonment and adoption. In the event that a saved, named object is abandoned (for example, its owner agent is terminated or explicitly abandons the object), another agent that publishes an object with the same name, type and information model location can adopt it. Agents can also have callbacks triggered when an object that they are subscribed to is abandoned or adopted. The Abandoned Object Adoption tutorial demonstrates the adoption of an abandoned object.

In this tutorial, you use Distrix System Builder to create a simple project based on the "Pass-the-Package" party game. In Pass-the-Package, a gift is wrapped in several layers of gift-wrap and as it is passed around a circle, each person removes a layer of wrap. The person who unwraps the last layer wins the gift.

Your project will have one object, which is the "gift", and two agents, which are the gift-giver and the unwrapper.

At run time, the gift-giver agent sets the number of gift wrap layers, then abandons the object. Instances of the unwrapper agent wait for a callback to indicate that the object has been abandoned and each attempts to adopt the object.

If an unwrapper agent fails to adopt the object, it waits until the object is abandoned again. If an unwrapper agent successfully adopts the object, it decrements the number of gift wrap layers, then ends its own process, which abandons the object. This procedure is repeated until there are no gift wrap layers left. The unwrapper agent that reduces the gift wrap layers to zero is the game's winner.