Groups with More than Two Roles
You can extrapolate fault-tolerant behavior to an application with several distinct operating roles.
For example, consider an application that uses roles for graceful degradation of service. Each role subscribes to a different subset of messages by using different content matchers, and processes matching messages.
- B1 is an active role: the program processes high priority messages with matcher M1, and ignores the rest. The member with ordinal 1 operates in this role.
- B2 is an active role: the program processes medium priority messages with matcher M2, and ignores the rest. The member with ordinal 2 operates in this role.
- B3 is an active role: the program processes low priority messages with matcher M3, and ignores the rest. The member with ordinal 3 operates in this role.
- B4 is the standby role: the program does not process any messages. Any member with ordinal 4 or greater operates in this role.
When only one instance of application B is running, it has ordinal 1, role B1, and it processes messages with the highest priority. It does not devote any time to messages with medium or low priority.
When two instances are running, one instance, with ordinal 1, role B1, processes messages with high priority. Meanwhile the other instance, with ordinal 2, role B2, processes messages with medium priority. Neither devotes any time to messages with low priority.
When three instances are running, each instance processes messages with a different priority, and together they cover all the priorities. That is, one instance has ordinal 1, role B1, and processes messages with high priority. Meanwhile, the second instance, with ordinal 2, role B2, processes messages with medium priority. The third instance, with ordinal 3, role B3, processes messages with medium priority.
When four or more instances are running, the instances with ordinal greater than 3 idle in standby role B4, ready to processes messages if an instance in any of the processes in the three active roles were to become unavailable.