Consumer Class
The Consumer class supports dequeuing of Messages and controls the dequeuing options.
                  
Table 13-14 Enumerated Values Used by Consumer Class
| Attribute | Options | 
|---|---|
DequeMode  | 
                           
                              
  | 
                        
Navigation  | 
                           
                              
  | 
                        
Visibility  | 
                           
                              
  | 
                        
DequeWaitOption  | 
                           
                              
  | 
                        
Table 13-15 Summary of Consumer Methods
| Method | Description | 
|---|---|
| 
                               
  | 
                        |
| 
                               Retrieves the name of the   | 
                        |
| 
                               Retrieves she correlation id of the message that is to be dequeued.  | 
                        |
| 
                               Retrieves the dequeue mode of the   | 
                        |
| 
                               Retrieves the id of the message that is dequeued.  | 
                        |
| 
                               Gets the name of the queue used by the consumer.  | 
                        |
| 
                               Retrieves the position of the Message that is dequeued.  | 
                        |
| 
                               Retrieves the transformation applied before a   | 
                        |
| 
                               Retrieves the transactional behavior of the dequeue operation.  | 
                        |
| 
                               Retrieves the specified behavior of the   | 
                        |
| 
                               Tests whether the   | 
                        |
| 
                               Assignment operator for the   | 
                        |
| 
                               Receives and dequeues a   | 
                        |
| 
                               Sets the   | 
                        |
| 
                               Sets the   | 
                        |
| 
                               Specifies the correlation identifier of the message to be dequeued.  | 
                        |
| 
                               Specifies the locking behavior associated with dequeuing.  | 
                        |
| 
                               Specifies the identifier of the   | 
                        |
| 
                               Nullifies the   | 
                        |
| 
                               Specifies position of the   | 
                        |
| 
                               Specifies the name of a queue before dequeuing   | 
                        |
| 
                               Specifies transformation applied before dequeuing a   | 
                        |
| 
                               Specifies if   | 
                        |
| 
                               Specifies wait conditions if there are no   | 
                        
Consumer()
Consumer class constructor.
| Syntax | Description | 
|---|---|
Consumer( const Connection *conn);  | 
                              
                                  Creates a new   | 
                           
Consumer( const Connection *conn const Agent& agent);  | 
                              
                                  Creates a new   | 
                           
Consumer( const Connection *conn, const string& queue);  | 
                              
                                  Creates a new   | 
                           
Consumer( const Consumer& consumer);  | 
                              
                                  Copy constructor.  | 
                           
| Parameter | Description | 
|---|---|
conn  | 
                              
                                  The connection in which the  | 
                           
agent  | 
                              
                                  Agent assigned to the   | 
                           
queue  | 
                              
                                  Queue at which the   | 
                           
consumer  | 
                              
                                  Original   | 
                           
getCorrelationId()
Retrieves she correlation id of the message that is to be dequeued
Syntax
string geCorrelationId() const;
getDequeueMode()
Retrieves the dequeue mode of the Consumer. DequeueMode is defined in Table 13-14.
                     
Syntax
DequeueMode getDequeueMode() const;
getMessageIdToDequeue()
Retrieves the id of the message that is dequeued.
Syntax
Bytes getMessageToDequeue() const;
getPositionOfMessage()
Retrieves the position, or navigation, of the message that is dequeued. Navigation is defined in Table 13-14.
                     
Syntax
Navigation getPositionOfMessage() const;
getTransformation()
Retrieves the transformation applied before a Message is dequeued.
                     
Syntax
string getTransformation() const;
getVisibility()
Retrieves the transactional behavior of the dequeue operation, or visibility. Visibility is defined in Table 13-14.
                     
Syntax
Visibility getVisibility() const;
getWaitTime()
Retrieves the specified behavior of the Consumer when waiting for a Message with matching search criteria. DequeWaitOption is defined in Table 13-14.
                     
Syntax
DequeWaitOption getWaitTime() const;
isNull()
Tests whether the Consumer object is NULL. If the Consumer object is NULL, TRUE is returned; otherwise, FALSE is returned.
                     
Syntax
bool isNull() const;
operator=()
Assignment operator for Consumer class.
                     
Syntax
void operator=( const Consumer& consumer);
| Parameter | Description | 
|---|---|
consumer  | 
                              
                                  The original   | 
                           
receive()
Receives and dequeues a Message.
                     
Syntax
Message receive( Message::PayloadType pType, const string& type="", const string& schema="");
| Parameter | Description | 
|---|---|
pType  | 
                              
                                  The type of payload expected. Payload Type is defined in Table 13-14.  | 
                           
type  | 
                              
                                  The type of the payload when   | 
                           
schema  | 
                              
                                  The schema in which the type is defined when   | 
                           
setAgent()
Sets the Agent's name and address (queue name) on the consumer.
                     
Syntax
void setAgent( const Agent& agent);
| Parameter | Description | 
|---|---|
agent  | 
                              
                                  Name of the   | 
                           
setConsumerName()
Sets the Consumer name. Only messages with matching consumer name can be accessed. If a queue is not set up for multiple consumer, this option should be set to NULL.
                     
Syntax
void setConsumerName( const string& name);
| Parameter | Description | 
|---|---|
name  | 
                              
                                  Name of the   | 
                           
setCorrelationId()
Specifies the correlation identifier of the message to be dequeued. Special pattern matching characters, such as the percent sign (%) and the underscore(_) can be used. If several messages satisfy the pattern, the order of dequeuing is undetermined.
Syntax
void setCorrelationId const string& id);
| Parameter | Description | 
|---|---|
id  | 
                              
                                  The identifier of the   | 
                           
setDequeueMode()
Specifies the locking behavior associated with dequeuing.
Syntax
void setDequeueMode( DequeueMode mode);
| Parameter | Description | 
|---|---|
mode  | 
                              
                                  Behavior of enqueuing.   | 
                           
setMessageIdToDequeue()
Specifies the identifier of the Message to be dequeued.
                     
Syntax
void setMessageIdToDequeue( const Bytes& msgid);
| Parameter | Description | 
|---|---|
msgid  | 
                              
                                  Identifier of the   | 
                           
setNull()
Nullifies the Consumer; frees the memory associated with this object.
                     
Syntax
void setNull();
setPositionOfMessage()
Specifies position of the Message to be retrieved.
                     
Syntax
void setPositionOfMessage( Navigation pos);
| Parameter | Description | 
|---|---|
pos  | 
                              
                                  Position of the message,   | 
                           
setQueueName()
Specifies the name of a queue before dequeuing Messages. Typically used when dequeuing multiple messages from the same queue.
                     
Syntax
void setQueueName( const string& queue);
| Parameter | Description | 
|---|---|
queue  | 
                              
                                  The name of a valid queue in the database.  | 
                           
setTransformation()
Specifies transformation applied before dequeuing the Message.
                     
Syntax
void setTransformation( string &fName);
| Parameter | Description | 
|---|---|
fName  | 
                              
                                  SQL transformation function.  | 
                           
setVisibility()
Specifies if Message should be dequeued as part of the current transaction. Visibility parameter is ignored when in DEQ_BROWSE mode.
                     
Syntax
void setVisibility( Visibility option);
| Parameter | Description | 
|---|---|
option  | 
                              
                                  Visibility option being set, defined in Table 13-14.  | 
                           
setWaitTime()
Specifies wait conditions if there are no Messages with matching criteria. The wait parameter is ignored if messages in the same group are being dequeued.
                     
Syntax
void setWaitTime( DequeWaitOption wait);
| Parameter | Description | 
|---|---|
wait  | 
                              
                                  Waiting conditions.   |