[BACK-PROC-06] Integrating B2B Ingestion with AuthService and Publishing Product Lists to Kafka

Product Ingestion Process Service

Published

October 14, 2026

NoteTask Brief
  • Repository / Component: product_process_service (Go).
  • Stack: Go, gRPC/HTTP Client, Apache Kafka.
  • Task Type: Backend (Integration & Queues).
  • Status: Ready for Implementation

Task Description

It is necessary to refactor the current B2B product ingestion endpoint that receives product data from partner stores. You must remove the hardcoded token validation, configure a synchronous request to the AuthService to verify the partner, and upon success, push the incoming JSON product list into a Kafka topic for asynchronous processing by a background worker.

Step-by-Step Instructions

  1. Removing Hardcoded Verification: Completely remove verification checks such as if token == "hardcoded_token" from the codebase.
  2. Integrating the Network Client: Set up a gRPC/HTTP client to communicate with the AuthService. Invoke the ValidateStoreToken method, forwarding the token extracted from the request header (Authorization: Bearer <b2b_token>).
  3. Handling the Authorization Response:
    • If the AuthService returns an error or a refusal, instantly abort the operation and return a structured error response to the partner store (referencing the previous task: mapping to gRPC code 16 or HTTP 401).
  4. JSON Validation and Kafka Publication (Pipeline):
    • Upon successful authorization, parse the incoming product array sent by the store.
    • Construct a DTO message for the message queue, enriching it with the retrieved store_id metadata.
    • Publish (Produce) the message to the Kafka topic named b2b_products_intake. The message must be transmitted strictly in JSON Lines or a structured JSON format.