Multi-Agent Example Showing Event Handling
In a load balancing group shown in the example, concepts are shared and events are not shared .
Example Scenario
Agent A has the following rules:
Rule | Scope | Condition | Action |
---|---|---|---|
R1 | Event E1 | None | Create concept C1 |
R2 | Event E2, Concept C1 | E2.x == C1.x; | Send event E3 |
Agent A listens to destinations on which events E1 and E2 arrive.
You start two instances of agent A called A1 and A2. Both are active, therefore they both listen to the destinations on which events E1 and E2 arrive. At runtime, the arrival of two events illustrates the expected behavior.
Agent A1 receives an instance of Event E1:
- Rule R1 executes and creates an instance of concept C1.
- During the post RTC phase, the instance of C1 is written to cache.
- Event E1 has a Time to Live of 30 seconds. It is acknowledged and then moved to the cache.
- With cache plus memory mode, Agent A2 receives a notification and loads the instance of concept C1 in its Rete network. With cache only mode, Agent A2 has to explicitly load the concept when it will be needed for an RTC.
Note that the event E1 is in the cache, but Agent A2 does not load the event in its Rete network. However, if the node (JVM) containing Agent A1 fails, then Agent A2 moves the pending events to its Rete network.
Copyright © Cloud Software Group, Inc. All rights reserved.