# tibemsMsgConsumer_ReceiveTimeout

Function

## Purpose

Receive a message (synchronous, blocks up to a time limit).

## C Declaration

    tibems_status tibemsMsgConsumer_ReceiveTimeout(
        tibemsMsgConsumer msgConsumer,
        tibemsMsg* message,
        tibems_long timeout );

## COBOL Call

    CALL "tibemsMsgConsumer_ReceiveTimeout"
         USING BY VALUE msgConsumer,
               BY REFERENCE message,
               BY VALUE timeout,
               RETURNING tibems-status
    END-CALL.

Note: `msgConsumer` and `message` have usage pointer.

## Parameters

Parameter | Description
--- | ---
`msgConsumer` | Receive a message through this consumer.
`msg` | Store a pointer to the inbound message in this location.
`timeout` | Wait no longer than this interval (in milliseconds) for a message to arrive. Zero is a special value, which specifies no timeout (block indefinitely).

## Remarks

This function consumes the next message from the consumer’s destination. When the destination does not have any messages ready, this function blocks:

- If a message arrives at the destination, this call immediately consumes that message and returns.
- If the (non-zero) timeout elapses before a message arrives, this call returns `TIBEMS_TIMEOUT`.
- If another thread closes the consumer, this call returns `TIBEMS_INTR`.

When calling receive within a transaction, the consumer retains the message until transaction commits.

## See Also

`tibemsMsgConsumer_Receive`

`tibemsMsgConsumer_ReceiveNoWait`

Copyright © Cloud Software Group, Inc. All rights reserved.