TibrvCmTransport::sendRequest()

Method

Declaration

TibrvStatus sendRequest(
    const TibrvMsg& requestMsg,
    TibrvMsg& replyMsg,
    tibrv_f64 timeout);

Purpose

Send a labeled request message and wait for a reply.

Blocking can Stall Event Dispatch

Warning 

This call blocks all other activity on its program thread. If appropriate, programmers must ensure that other threads continue dispatching events on its queues.

Parameter

Description

requestMsg

Send this request message.

Wildcard subjects are illegal.

replyMsg

The program supplies a variable, and the method stores the inbound reply in that variable.

The program need not create the reply message, nor allocate space for it. However, the program must destroy the reply message, even though it did not create it.

timeout

Maximum time (in seconds) that this call can block while waiting for a reply.

TIBRV_WAIT_FOREVER (-1) indicates no timeout (wait without limit for a reply).

Remarks

Programs that receive and process the request message cannot determine that the sender has blocked until a reply arrives.

The sender and receiver must already have a certified delivery agreement, otherwise the request is not certified.

The request message must have a valid destination subject; see TibrvMsg::setSendSubject().

A certified request does not necessarily imply a certified reply; the replying program determines the type of reply message that it sends.

Operation

This method operates in several synchronous steps:

Procedure 

1. Create a TibrvCmListener that listens for messages on the reply subject of requestMsg.
2. Label and send the outbound requestMsg.
3. Block until the listener receives a reply; if the time limit expires before a reply arrives, then return the status code TIBRV_TIMEOUT. (The reply event uses a private queue that is not accessible to the program.)
4. Store the reply in the variable specified by the replyMsg parameter.
5. Return.

See Also

TibrvCmTransport::send()

TibrvCmTransport::sendReply()