Recent changes Random page
GAMING
Technology
 
Gaming
Entertainment
Science Fiction
Biggest wikis
Hobbies
Music
See more...

Broadcast

From Indus Communities

Jump to: navigation, search

Agents use the Broadcast style of coordination to send a message across to a group of other Agents and Components and then optionally apply logic on returned results.

In the broadcast style of coordination, an Agent uses a channel to send the same message to multiple agents and components with the same method signature.

Syntax:

	Broadcast( agent.methodName(paramlist), component.methodName(paramlist);   
                  [agent[ ]|component[ ]].methodName(paramlist);result)    
        {
	    // logic to execute when return value is assigned
        }

where,

  • agent and component are instances of type Agent and Component
  • agent[ ] and component[ ] are arrays of type Agent and Component

The Broadcast style of coordination is different from the Callback style of coordination in many ways

  • in contrast to the callback style, broadcast allows multiple agents and component instances (separated by commas) to be invoked
  • all the agents / components invoked in broadcast need to have the same method signature
  • in contrast to the master-worker and callback style where the channel is cleared after assigning the return value to the result variable specified, broadcast does not clear (stop) the channel after a handle (that is an object of type Agent or Component with agent/component role and id as attributes) is passed to the following logic block. After the logic block executes, a new handle (response from another agent or component) is fetched from the channel and this iteration continues till all the agents and components invoked during the broadcast respond. After this happens, the channel is cleared
  • an Agent or Component (returning the call) role and id can be retrieved in the logic block in the broadcast style of coordination by using __broadcast__agent__role and __broadcast__agent__id respectively
  • broadcast allows an array of agents or components to be invoked at the same time. An array of type Agent or Component, in this case, represents all instances of the Agent or Component that are present across the network at that point in time
  • The Broadcast style of coordination also allows invoking methods on agents and components that do not return a value. In this case, the following syntax applies.

Syntax:

	Broadcast( agent.methodName(paramlist), component.methodName(paramlist);   
                  [agent[ ]|component[ ].methodName(paramlist);)    

where,

  • agent and component are instances of type Agent and Component
  • agent[ ] and component[ ] are arrays of type Agent and Component


Next : Voter Coordinator

Rate this article:
Share this article: