-
Notifications
You must be signed in to change notification settings - Fork 2
events
HS events and queries are used to initiate actions in response to incoming messages sent by remote objects. The message structure, defined by the Ab Initio Protocol, contains details on what action is to be performed by the target object. Typically, the remote object is a HS process that sends messages using the event or query method. But any type of process can send messages if it understands the Ab Initio Protocol.
SEE ALSO: HS Methods, HS Objects
When a message is received, an event is generated that directs the HS program to perform the requested action. There are three types of events that an incoming message can generate: EVENT, QUERY, and REPLY. The program must be in the IDLE state (see the idle method) before it can receive EVENT and QUERY messages. The mode method can be used to determine what type of event was generated, and method can be used to find out what method was requested.
An incoming EVENT message requests a method to be executed. The method must be defined and enabled. The message can contain tokens and values, which are passed to the method as arguments. An EVENT message is generated by calling the _event_method. No reply to an EVENT message is required.
An incoming QUERY message requests a method to be executed, and data values to be returned to the sender in the REPLY message. The method must be defined and enabled. The message can contain tokens and values, which are passed to the method as arguments. If tokens are supplied without values, the method is expected to assign values to these tokens before returning. The STATUS variable is always included as the last token, without a value, so that the target is obligated to return a value for it. A QUERY message is generated by calling the query method. A REPLY message is automatically generated, and contains all the token values requested by the sender.
A REPLY message is received in response to a successful call to the query method. It contains the token values from the target that were requested in the query call. The query call will block until a REPLY message is received, or until some run time condition, such as a timeout, occurs. These conditions are fully described in the documentation on the query method.