Responses arrive against the wrong request
An answer lands on the wrong case in your system. Or the exchange refuses a request as a duplicate, or refuses a callback it cannot match. All three come from how your system sets and reads the correlation ID and the API call ID.
In short
- Open each cycle with a new correlation ID, equal to that request's API call ID.
- Every message in the cycle echoes it. Every call gets a new API call ID.
- A failed cycle's correlation ID is inactive, so start a new cycle.
- Match incoming messages on the correlation ID, never on arrival order.
Prerequisites
- You log the
x-hcx-correlation_idandx-hcx-api_call_idof every message you send and receive.
Work through these in order
- Does each request cycle get its own correlation ID? Generate a new random 36-character identifier for every request that opens a cycle. Set it equal to that request's API call ID. Never copy one from an example.
- Does every message in the cycle carry it unchanged? The answer, any query and every callback echo the request's correlation ID. The answer's own API call ID is different.
- Is the API call ID new on every call? Generate a fresh one for every call, retries included.
- Did you reuse a failed cycle's correlation ID? After an error the correlation ID becomes inactive. A new request with it is refused with
NHCX-1006. Start a fresh cycle with a new ID. - Do you match answers by correlation ID? Store the correlation ID against the case before you send. Match every incoming message on it, never on arrival order or time.
- If you are the payer, is the recipient right? The recipient code of your answer is the sender code of the request you answer.
What you see when it works
Every callback lands on the case whose request carried its correlation ID. New requests are accepted with 202, and your logs show no NHCX-1006 or NHCX-1010.
When it goes wrong
If one case's answers keep landing elsewhere, compare the correlation ID in the misplaced callback with the one stored on each case. Two cases holding the same value point at a generator that repeats. A status check shows which request the exchange holds for an ID.
| Code | What it means |
|---|---|
NHCX-1006 | A request with the same correlation ID already exists |
NHCX-1010 | No data for the correlation ID of a callback |
NHCX-1012 | No records for an API call ID |
PAYR-1516 | No event found for the API call ID and correlation ID of an error response |
Next steps
- Envelope Fields: every identifier on the envelope, and when each one changes.
- JWE, Status and Errors: how a cycle threads from request to answer.
- When something breaks: the other symptoms.