A correlation instance subscription is created when the shape that initializes the correlation set is executed. An orchestration may be suspended, and the orchestration may be put in the suspended resumable state. In this situation, the correlation instance subscription is not deleted. Therefore, any new incoming message that matches the correlation instance subscription is delivered to the orchestration that is in the suspended resumable state.
The correlation instance subscription is deleted only when the orchestration finishes or terminates.
The initial receive shape and the correlated receive shape may use the same message type. In this situation, you can require the new incoming message to create a new orchestration. The new orchestration must contain logic to do the following things:
- To catch the exception that suspends the message
- To save the message and any error details
- To terminate itself so that the next message can create a new orchestration
Or, you can save the message and any error details. Then, you can require the correlated receive shape to handle the next message within the same orchestration.