How to combine many agents onto a single thread¶
You've constructed your process out of multiple agents, but want several of them to run on the same thread.
Combine your agents into a
CompositeAgent, and schedule the
CompositeAgent in an
1 2 3 4 5 6 7
The agents within a
CompositeAgent share the same thread and idle strategy. Their duty cycles are called sequentially, in the order they are added in the
CompositeAgent constructor. When you run a Media Driver with a SHARED Threading Strategy, the Conductor, Sender and Receiver agents are scheduled within a
The default thread name is a composite of the roleName provided for each agent. If needed, the CompositeAgent's thread name can be set using
An alternative approach to do this is to use an
AgentInvoker, and run
invoke() within the duty cycle of your other agent.