Kafka Events

Event-driven integration guide for the Marketplace Service

Overview

The Marketplace Service uses Apache Kafka (Amazon MSK Serverless) for asynchronous event-driven communication. All events follow the CloudEvents 1.0 specification with tenant_id as the partition key for data isolation.

Kafka on Lambda

Kafka producers are enabled via the KAFKA_ENABLED environment variable. On Lambda, this is set to false by default — events are silently skipped. Enable Kafka when the service is connected to the VPC with MSK access.

Broker

boot-gpm4u49z.c2.kafka-serverless.us-east-1.amazonaws.com:9098

CloudEvents Envelope

{
  "specversion": "1.0",
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "type": "eventzr.marketplace.listing.created.v1",
  "source": "marketplace-svc",
  "time": "2026-03-02T12:00:00.000Z",
  "datacontenttype": "application/json",
  "subject": "listing:uuid",
  "tenantid": "00000000-0000-0000-0000-000000000001",
  "data": {
    "id": "listing-uuid",
    "title": "Premium Catering Service",
    "lane": "vendora",
    "sellerId": "seller-uuid",
    "price": 5000,
    "currency": "USD"
  }
}

Producer Topics (12)

Events published by marketplace-svc:

TopicDescriptionPayload
eventzr.marketplace.listing.created.v1Emitted when a new marketplace listing is createdListing entity with seller info, lane, pricing
eventzr.marketplace.listing.published.v1Emitted when a listing transitions to published stateListing ID, seller ID, lane, publish timestamp
eventzr.marketplace.listing.updated.v1Emitted when listing details are modifiedUpdated listing fields (partial)
eventzr.marketplace.listing.closed.v1Emitted when a listing is closed or deactivatedListing ID, close reason, final statistics
eventzr.marketplace.quote.submitted.v1Emitted when a buyer submits a quote on a listingQuote entity with listing ID, amount, message
eventzr.marketplace.quote.accepted.v1Emitted when a seller accepts a quoteQuote ID, listing ID, accepted amount
eventzr.marketplace.order.created.v1Emitted when an order is created from an accepted quoteOrder entity with quote reference, buyer/seller IDs
eventzr.marketplace.order.completed.v1Emitted when an order is marked as completedOrder ID, completion timestamp, final amount
eventzr.marketplace.order.cancelled.v1Emitted when an order is cancelledOrder ID, cancellation reason, refund status
eventzr.marketplace.dispute.opened.v1Emitted when a dispute is opened on an orderDispute entity with order reference, reason, evidence
eventzr.marketplace.dispute.resolved.v1Emitted when a dispute is resolved by adminDispute ID, resolution outcome, notes
eventzr.marketplace.rfp.broadcast.v1Emitted when an RFP is broadcast to matching sellersRFP entity with requirements, target lanes, deadline

Consumer Topics (6)

Events consumed by marketplace-svc from other services:

TopicSourceDescription
eventzr.event.created.v1event-svcConsumes event creation events to auto-create marketplace context (exhibitor slots, sponsorship opportunities)
eventzr.reviews.review.created.v1reviews-svcConsumes review events to update seller ratings and listing quality scores
eventzr.wallet.payment.completed.v1wallet-svcConsumes payment completion events to transition orders to paid status
eventzr.wallet.escrow.released.v1wallet-svcConsumes escrow release events to complete seller payouts on order delivery
eventzr.subscriptions.subscription.changed.v1subscriptions-svcConsumes subscription change events to update seller tier entitlements and listing limits
eventzr.user.profile.updated.v1user-svcConsumes profile update events to sync seller display info across listings

Integration Example

Subscribe to marketplace events using @eventzr/kafka:

import { KafkaConsumer, OnMessage } from '@eventzr/kafka';

@KafkaConsumer({ groupId: 'your-service-marketplace-consumer' })
export class MarketplaceEventHandler {
  @OnMessage('eventzr.marketplace.listing.created.v1')
  async handleListingCreated(event: CloudEvent) {
    const { tenantid, data } = event;
    // Process the new listing in your service context
    console.log(`New listing in lane ${data.lane}: ${data.title}`);
  }

  @OnMessage('eventzr.marketplace.order.completed.v1')
  async handleOrderCompleted(event: CloudEvent) {
    const { data } = event;
    // Trigger post-order workflows (review request, analytics, etc.)
    console.log(`Order ${data.id} completed`);
  }
}