AI Briefing
KO

Practical API Integration Know-How for an Open-Market Travel Platform

·2024.07.23 10:59

Key point

For detail pages, fault tolerance is key; for reservations, eventual consistency and idempotency are key.

1 / 2

Details

Because the travel platform operates by weaving together APIs from the Gmarket commerce system and OTA servers, a single screen and a single reservation flow can involve 10 or more APIs. That's why the integration strategy needs to differ based on the importance and response characteristics of each feature.

For the travel product detail page, fault tolerance matters most. Low-importance APIs are given short timeouts to prevent delay propagation, while critical APIs like price and inventory are given more time even if the response takes longer. For something like the discount price API, if a failure occurs, a fallback can be set up using resilience4j's CircuitBreaker and fallbackMethod to show the original price instead.

Real-time reservations must guarantee eventual consistency and idempotency. Since payment, settlement, and service provision are all linked, the states of the travel platform, the commerce system, and the OTA need to be aligned at the same stage. To achieve this, a state machine is built that defines the state of each system and matches them against one another.

If states become misaligned, an orchestrator-like reconciliation batch checks the reservation state of each system and re-integrates them. Even if a call fails due to a temporary outage or timeout, the server-side processing may actually have completed, so duplication must be checked before retrying.

  • If a duplicate request error code is specified, that request is treated as successful.
  • If there is no error code, a status lookup API is used to check whether it can proceed.
  • If the state has not yet transitioned, a retry is performed after a set time using spring-retry's backoff.

If the issue still isn't resolved, a compensating transaction must be used to restore the original state. It's safer to integrate with external systems that are easy to reverse first, and to place requests that are hard to cancel or carry penalties—like actual OTA reservations directly tied to monetary transactions—last.

This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.

Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.