Designing an Arrival Notification and Inventory Synchronization System for Offline Limited-Edition Products

    This article presents a practical system design for publishing arrival information for offline limited-edition products. It covers campaign configuration, store inventory consistency, reservations and purchase intents, notification delivery, auditing, and observability. Readers will learn how to address overselling, duplicate notifications, inventory desynchronization, and traceability through layered architecture, explicit state machines, idempotency, conditional inventory updates, deduplicated messaging, and operational monitoring.

    Publishing arrival information for offline limited-edition products may look like simply “posting a notification,” but it actually involves campaign configuration, store inventory, reservation limits, message delivery, data auditing, and other components. Without unified modeling and consistency control, problems such as overselling, duplicate notifications, out-of-sync store inventory, and untraceable operational data can easily occur. From a general technical perspective, this article provides a practical system design approach for scenarios such as limited-edition product arrival notifications, store distribution, and reservation registration.

    1. Scenario Abstraction and Core Challenges

    After abstracting the original information, the core business can be described as follows: a campaign publishes arrival information for limited-edition products at a specified time; users can view sellable status at nearby stores and initiate reservations or purchase intents; and the system must ensure inventory accuracy, timely notifications, and auditable behavior under multi-store, multi-batch, and high-concurrency access.

    The main challenges include:

    1. Timeliness of information publication: Arrival information must be configured before the campaign starts and take effect uniformly within a specified time window to avoid premature exposure.
    2. Inventory consistency: Store inventory, central inventory, and reservation occupancy must remain consistent to prevent the same item from being occupied multiple times.
    3. Concurrency and overselling control: Hot products may receive a large number of requests in a short period. Preoccupancy, idempotency, and purchase-limit policies are needed to control risk.
    4. Notification delivery reliability: Arrival notifications and reservation result notifications must be retryable and deduplicated to prevent users from receiving duplicate messages.
    5. Operational observability: Key events such as publication, changes, reservations, and redemption must be recorded to support troubleshooting and data statistics.

    2. Overall Architecture Design

    A layered architecture is recommended, dividing the system into an access layer, business service layer, data layer, and supporting layer.

    • Access layer: Provides APIs for queries, reservations, and notification subscriptions, with unified authentication, rate limiting, and parameter validation.
    • Business service layer: Includes campaign service, item service, inventory service, reservation service, and notification service.
    • Data layer: Uses a relational database to store core data such as campaigns, items, stores, and reservations; uses distributed cache for hot inventory queries; and uses object storage for campaign assets and audit archives.
    • Supporting layer: Includes common capabilities such as message queues, logging services, monitoring and alerting, and configuration centers.

    For deployment, the system can run on a general container platform or a cloud environment such as Baidu AI Cloud, and scale horizontally to handle campaign peaks. The architecture should follow the principles of “read-heavy, write-light” and “hotspot isolation”: item details and store lists are primarily served from cache, while inventory deductions and reservation writes go through independent services to avoid mutual interference.

    3. Key Data Models

    The core entities can be designed as follows:

    1. Activity(activity_id, title, start_time, end_time, status)
    2. Store(store_id, name, region, status)
    3. Item(item_id, activity_id, name, total_stock, per_user_limit)
    4. StoreStock(store_id, item_id, available_qty, reserved_qty, version)
    5. Reservation(reservation_id, user_id, store_id, item_id, qty, status, idempotency_key)
    6. NotifyTask(task_id, user_id, template_id, biz_key, status, retry_count)

    Here, StoreStock.version is used for optimistic locking, Reservation.idempotency_key is used for idempotency control, and NotifyTask.biz_key is used for message deduplication. Activity status should use an explicit state machine, such as “Draft, Pending Publish, In Progress, Ended, Offline,” instead of being determined by a combination of multiple Boolean fields.

    4. Arrival Information Publication Flow

    The publication flow should separate “configuration” from “activation.” Operations staff first create campaign and item information, and the system performs completeness validation, including the time window, store scope, total inventory, and purchase-limit rules. After validation passes, the campaign enters the pending-publish state.

    During publication, the campaign service generates a publication event and writes it to the message queue. Downstream services then refresh caches, generate notification tasks, and record audit logs. The publication API must support idempotency: when the same campaign and the same version are submitted repeatedly, it returns the same result without generating duplicate notification tasks.

    Example pseudocode:

    1. function publishActivity(activityId, version, operator):
    2. activity = activityRepo.get(activityId)
    3. if activity.version != version:
    4. return conflict("Version has changed, refresh and retry")
    5. validate(activity)
    6. activity.status = "PUBLISHING"
    7. activityRepo.saveWithVersion(activity, version)
    8. event = buildEvent("ActivityPublished", activityId, version)
    9. messageQueue.publish("activity-events", event)
    10. auditLog.record(operator, "publish", activityId, version)
    11. return success()

    Downstream consumers refresh caches and generate notification tasks based on the event. Consumers must be idempotent. It is recommended to use “event ID + consumer group” as the deduplication key to ensure that repeated delivery does not produce duplicate business results.

    5. Inventory Synchronization and Overselling Prevention

    Inventory is central to limited-edition product scenarios. It is recommended to divide inventory into “sellable inventory,” “reservation-occupied inventory,” and “redeemed inventory,” with all changes completed uniformly through the inventory service. The query path can read from cache, but the write path must be based on the database or strongly consistent storage.

    When making a reservation, three steps are performed: validate purchase limits, validate store inventory, and perform atomic preoccupancy. Preoccupancy can use a conditional update:

    1. update StoreStock
    2. set reserved_qty = reserved_qty + :qty,
    3. version = version + 1
    4. where store_id = :storeId
    5. and item_id = :itemId
    6. and version = :version
    7. and available_qty - reserved_qty >= :qty

    If the number of affected rows is 0, it indicates insufficient inventory or a version conflict. The system can return “insufficient inventory” or retry briefly. For hot inventory, a pre-check in cache can be added to reduce database pressure, but the final deduction must still be based on the conditional update in the persistent layer. Purchase-limit rules need to be validated by user, item, and campaign dimensions, with a reasonable time window to prevent repeated occupancy across stores.

    6. Notifications and Message Deduplication

    Arrival notifications and reservation success notifications should be processed asynchronously. After consuming business events, the notification service generates notification tasks and then calls the common messaging channel to send them. Each notification task should include a business key, such as “campaign ID + item ID + user ID + notification type.” Before sending, the service checks whether the notification has already been sent successfully, and records the status after success.

    Failed retries should use a backoff strategy and set a maximum retry count. After exceeding the threshold, tasks enter a failure queue for manual handling through the operations console. Notification templates and channel configurations should be versioned to avoid content inconsistency caused by arbitrary changes during a campaign.

    7. Observability and Security Auditing

    The system needs to cover three types of observability: metrics, logs, and tracing. Key metrics include campaign publication success rate, reservation request volume, inventory conflict count, notification failure rate, and API P95 latency. Logs should record request ID, user identifier, campaign identifier, and result code to facilitate correlated troubleshooting.

    For auditing, operations such as publication, inventory adjustment, purchase-limit rule changes, and manual notification resend should record the operator, time, before and after values, and reason. Sensitive fields should be stored in masked form, and API access requires authentication and rate limiting. After a campaign ends, audit logs and statistical results can be archived, and necessary retention periods should be maintained to meet compliance requirements.

    8. Best Practices Summary

    1. Separate campaign configuration from activation, and use a state machine to manage the lifecycle.
    2. Make publication, reservation, and notification idempotent across the entire chain to avoid duplicate business results.
    3. Use conditional updates as the source of truth for inventory writes, and use cache only for query acceleration.
    4. Apply independent rate limiting and degradation to hot products to protect the core inventory service.
    5. Make notification tasks retryable, deduplicated, and open to manual intervention.
    6. Establish auditing, monitoring, and alerting so that problems can be discovered, traced, and recovered.

    With the design above, publication of arrival information for offline limited-edition products can be upgraded from a simple notification page into an operable, auditable, and extensible technical system that maintains inventory accuracy and a stable user experience during campaign peaks.