# tibemsSession_Recover

Function

## Purpose

Recover from undetermined state during message processing.

## C Declaration

    tibems_status tibemsSession_Recover(
        tibemsSession session );

## COBOL Call

    CALL "tibemsSession_Recover"
        USING BY VALUE session,
        RETURNING tibems-status
    END-CALL.

Note: `session` has usage pointer.

## Parameters

Parameter | Description
--- | ---
`session` | Recover this session.

## Remarks

Exceptions during message processing can sometimes leave a program in an ambiguous state. For example, some messages might be partially processed. This function lets a program return to an unambiguous state—the point within the message stream when the program last acknowledged the receipt of inbound messages. Programs can then review the messages delivered since that point (they are marked as redelivered), and resolve ambiguities about message processing. Programs can also use this function to resolve similar ambiguities after a `tibemsConnection` stops delivering messages, and then starts again.

## Operation

This function requests that the server:

1. Stop message delivery within the session.
2. Mark as redelivered, any messages that the server has attempted to deliver to the session, but for which it has not received acknowledgement (that is, messages for which processing state is ambiguous). According to the JMS specification, the server need not redeliver messages in the same order as it first delivered them.
3. Restart message delivery (including messages marked as redelivered in step 2).

## Transactions

Commit and rollback are more appropriate with transactions. When a session has transactional semantics, this call is illegal, and returns `TIBEMS_INVALID_SESSION`.

## See Also

`tibemsMsg_Recover`

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