Skip to content

feat(compose-eventbridge-custom-bus): bring the example to the standard with a live test - #846

Merged
czubocha merged 2 commits into
v4from
branch/dreamy-lamport-709whe-eventbridge-custom-bus
Nov 26, 2026
Merged

czubocha merged 2 commits into
v4from
branch/dreamy-lamport-709whe-eventbridge-custom-bus

Conversation

@czubocha

Copy link
Copy Markdown
Contributor

Brings compose-eventbridge-custom-bus to the example standard: example.json with a live test, a test/smoke.mjs check, the README in the standard sections, and the producer's dependency pinned.

Lesson (unchanged): a stateful service owns an EventBridge Custom Event Bus, and the eventBridge event subscribes functions in another service to it, wired with Serverless Compose: fulfil gets one event at a time in publish order (ordering: fifo, batchSize: 1), audit gets arrays with a dead-letter queue.

Changes

  • example.json: title and description kept from examples.json; services lambda, eventbridge, sqs, iam, logs; one script check.
  • test/smoke.mjs: invokes the producer for five orders of a unique customer, then asserts that fulfil logged sequences 1 to 5 in that order and that audit received all five.
  • README: What it deploys, Prerequisites (Region availability, the 5-bus quota, iam:PassRole), Deploy and Try it with output from a real run, How it works (wiring, consumers, delivery role and producer), When to use a Custom Event Bus, Personal and preview stages, Cost and cleanup, Next steps. All links absolute.
  • producer: @aws-sdk/client-eventbridgev2 pinned to 3.1172.0; npm audit: 0 vulnerabilities. Deploy uses npm ci.

Evidence

Serverless Framework 4.47.0, 2026-11-25.

  • Static: node scripts/check-examples.mjs compose-eventbridge-custom-bus 0 errors, npm run validate 0 errors, npm test 323 passed, npm run check-docs clean, on the current v4. --package is not used for Compose examples whose services read another's output.
  • Hand run of the README (us-east-1): deploy of all three services, producer invoke with count: 5, fulfil logged sequences 1 to 5 in order, audit received batches of 4 and 1; removed.
  • Live test (scripts/test-example.mjs):
    PASS compose-eventbridge-custom-bus 4.47.0 248s   # us-east-1
    PASS compose-eventbridge-custom-bus 4.47.0 247s   # eu-west-1
    [check] published 5 orders for customer-984661e3 -> fulfil logged sequences 1,2,3,4,5 in order; audit received all 5
    
  • Negative control: a scratch copy whose fulfil logs a different handler name stopped at the check step: fulfil logged 0 of 5 orders and audit received 5 of 5.
  • Leftovers: no stack, Lambda log group or AWS::EventsV2::EventBus for any test stage in us-east-1 or eu-west-1.
  • Fresh-agent test (an agent given only the example folder): deployed, saw the producer output, the ordered fulfil lines and batched audit lines as the README shows, removed, confirmed the stacks and bus gone; no README step needed a guess.

Generated by Claude Code

@czubocha
czubocha merged commit ca7fa81 into v4 Nov 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant