Skip Headers

Oracle® C++ Call Interface Programmer's Guide
10g Release 1 (10.1)

Part Number B10778-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

Listener Class

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()
Listener class constructor.
getAgentList()
Retrieve the list of Agents for which the Listener provides its services.
getTimeOutForListen()
Retrieve the time out for a call.
listen()
Listens for Messages and returns the name of the Agent for whom a Message is intended.
setAgentList()
Specifies the list of Agents for which the Listener provides its services.
setTimeOutForListen()
Specifies the time out for a listen() call.


Listener()

Listener class constructor.

Syntax Description
Listener(
   const Connection* conn);
Creates a Listener object.
Listener(
   const Connection* conn
   vector<Agent> &aglist,
   int waitTime=0);
Creates a Listener object and sets the list of Agents on behalf of which it listens on queues. Also sets the waiting time; default: no waiting.

Parameter Description
conn
The connection of the new Listener object.
aglist
The list of agents on behalf of which the Listener object waits on queues; clients of this Listener.
waitTime
The time to wait on queues for messages of interest for the clients; in seconds.


getAgentList()

Retrieve the list of Agents for which the Listener provides its services.


Syntax
vector<Agent> getAgentList() const;


getTimeOutForListen()

Retrieve the time out for a call.


Syntax
int getTimeOutForListen() const;


listen()

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.


Syntax
Agent listen();

Note:

This is a blocking call. Prior to this call, the following steps should be completed:
  • Each Agent must be registered with the listener using setAgentList() method.

  • The time out parameter should be set using the setTimeOutForListen() method. This is a blocking call that returns when a Message for one of the Agents on the list arrives. If no Messages arrive before the wait time expires, the call returns an error.



setAgentList()

Specifies the list of Agents for which the Listener provides its services.


Syntax
void setAgentList(
   vector<Agent>& list);
Parameter Description
list
The list of Agents.


setTimeOutForListen()

Specifies the time out for a listen() call.


Syntax
void setTimeOutForListen(
   int timeOut);
Parameter Description
timeOut
The time interval, in seconds, during which the Listener is waiting for Messages at specified queues.