# tibemsMsgConsumer_Receive

Function

## Purpose

Receive a message (synchronous).

## C Declaration

    tibems_status tibemsMsgConsumer_Receive(
        tibemsMsgConsumer msgConsumer,
        tibemsMsg* message );

## COBOL Call

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

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

## Parameters

Parameter | Description
--- | ---
`msgConsumer` | Receive a message through this consumer.
`message` | Store a pointer to the inbound message in this location.

## 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 another thread closes the consumer, this call returns `TIBEMS_INTR`.

When calling `tibemsMsgConsumer_Receive` from a transaction, the consumer retains the message until transaction commits.

## See Also

`tibemsMsgConsumer_ReceiveNoWait`

`tibemsMsgConsumer_ReceiveTimeout`

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