tibrvTransport_SendRequest()

Function

Declaration

tibrv_status tibrvTransport_SendRequest(
    tibrvTransport   transport,
    tibrvMsg         message,
    tibrvMsg*        reply,
    tibrv_f64        timeout);

Purpose

Send a 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

transport

Send the message and receive the reply on this transport.

message

Send this outbound message.

reply

The program supplies a location, and the function stores the inbound reply in that location.

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

The status code TIBRV_TIMEOUT indicates that the specified time expired before receiving a reply.

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

The request message must have a valid destination subject; see tibrvMsg_SetSendSubject().

Operation

This function operates in several synchronous steps:

Procedure 

1. Create an inbox name, and an event that listens to it. Overwrite any existing reply subject of message with the inbox name.
2. Send the outbound message.
3. Block until the listener receives a reply; if the time limit expires before a reply arrives, return the status code TIBRV_TIMEOUT. (The reply circumvents the event queue mechanism, so it is not necessary to explicitly call dispatch methods in the program.)
4. Store the reply in the location specified by the reply parameter.
5. Return.

See Also

tibrvMsg_Create()

tibrvTransport