| Oracle® C++ Call Interface Programmer's Guide 10g Release 1 (10.1) Part Number B10778-01 | 
 | 
| 
 | View PDF | 
The Listener class encapsulates the ability to listen for Messages, on behalf of registered Agents, at specified queues.
Table 10-20 Summary of Listener Methods
| Method | Summary | 
|---|---|
| Listener() | Listenerclass constructor. | 
| getAgentList() | Retrieve the list of Agents for which theListenerprovides its services. | 
| getTimeOutForListen() | Retrieve the time out for a call. | 
| listen() | Listens for Messages and returns the name of theAgentfor whom aMessageis intended. | 
| setAgentList() | Specifies the list of Agents for which theListenerprovides its services. | 
| setTimeOutForListen() | Specifies the time out for a listen() call. | 
Listener class constructor.
| Syntax | Description | 
|---|---|
| Listener( const Connection* conn); | Creates a Listenerobject. | 
| Listener( const Connection* conn vector<Agent> &aglist, int waitTime=0); | Creates a Listenerobject and sets the list ofAgents on behalf of which it listens on queues. Also sets the waiting time; default: no waiting. | 
| Parameter | Description | 
|---|---|
| conn | The connection of the new Listenerobject. | 
| aglist | The list of agents on behalf of which the Listenerobject waits on queues; clients of thisListener. | 
| waitTime | The time to wait on queues for messages of interest for the clients; in seconds. | 
Retrieve the list of Agents for which the Listener provides its services.
vector<Agent> getAgentList() const;
Retrieve the time out for a call.
int getTimeOutForListen() const;
Listens for Messages on behalf of specified Agents for the amount of time specified by a previous setTimeOutForListen() call. Returns the Agent for which there is a Message.
Agent listen();
| Note:This is a blocking call. Prior to this call, the following steps should be completed: 
 | 
Specifies the list of Agents for which the Listener provides its services.
void setAgentList( vector<Agent>& list);
| Parameter | Description | 
|---|---|
| list | The list of Agents. | 
Specifies the time out for a listen() call.
void setTimeOutForListen( int timeOut);
| Parameter | Description | 
|---|---|
| timeOut | The time interval, in seconds, during which the Listeneris waiting forMessages at specified queues. |