1. FE는 POST /api/v1/payments 로 아래와 같은 request body를 포함하여 요청을 보낸다.

    {
        "productId" : 1,
        "quantity" : 1
    }
    
  2. BE로 부터 202 Accepted status와 함께 아래의 response를 반환 받는다.

    {
        "productId": 1,
        "quantity": 1,
        "userId": 3,
        "seq": 7
    }
    
  3. POST /queue/status seq와 product id를 request body에 보내서 전체 대기인원 수 및 현재 내 앞에 몇명이 있는지 response로 응답받는다. 1~3초 사이의 난수 값으로 ms 단위로 프론트엔드에서는 요청할 것 ( polling 부하분산)

    Request Body

    {
        "productId" : 1,
        "seq" : 7
    }
    

    Response Body

    
        {
            "ahead": ahead,
            "total": total_waiting,
            "status" : "WAITING"
            // "status" : "COMPLETED"
            // "status" : "FAILED"
        }
    

기본 아이디어 (네 시나리오 반영)

  1. Gateway
  2. Redis (임시 상태 저장소)
  3. Payment-Service (Consumer)