Skip to content

CEXT-6482: Add multi-event-consumer sample - #70

Merged
iivvaannxx merged 18 commits into
mainfrom
CEXT-6482/event-consumer-sample-impl
Jul 27, 2026
Merged

CEXT-6482: Add multi-event-consumer sample#70
iivvaannxx merged 18 commits into
mainfrom
CEXT-6482/event-consumer-sample-impl

Conversation

@iivvaannxx

Copy link
Copy Markdown
Contributor

Summary

  • Adds an App Management sample showing how several Commerce event subscriptions can share a single runtime action.
  • Three Commerce events (order placed, customer saved, product saved) all route to a shared consumer action.
  • The consumer action resolves each declared event name to its I/O event code (resolveIoEventCode) and hands { code, action } routes to a reusable, domain-agnostic dispatcher (withEventRouter in lib/router.js), which matches the incoming CloudEvent type and forwards it to the right handler action via an OpenWhisk invoke.
  • Response bodies use the @adobe/aio-commerce-sdk response helpers (ok, badRequest), consistent with the rest of the app.

Test plan

  • npm install (postinstall codegen succeeds)
  • aio app build builds all 7 actions (3 app-management + consumer + 3 handlers) without errors
  • npx ultracite check passes on all new source files
  • Inspected the bundled consumer action to confirm resolveIoEventCode resolves against the declared event names and app id correctly

@obarcelonap obarcelonap left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we integrate aio-lib-telemetry?
is this pattern supported?

Comment thread events/multi-event-consumer/package.json Outdated
Comment thread events/multi-event-consumer/package.json Outdated
Comment thread events/multi-event-consumer/README.md Outdated
Comment thread events/multi-event-consumer/src/commerce-extensibility-1/lib/router.js Outdated
Comment thread events/multi-event-consumer/src/commerce-extensibility-1/lib/router.js Outdated
Shows how several Commerce event subscriptions can share a single
runtime action: the shared "consumer" action resolves each event's I/O
event code and dispatches it, via an OpenWhisk invoke, to the action
that actually handles it.
Match the unwrapped, one-line-per-paragraph style used by the other
sample READMEs in this repo.
The auto-generated installation action needs AIO_COMMERCE_AUTH_IMS_*
inputs for the app-management association flow, same as every other
aio-commerce-lib-app sample.
List all three APIs declared in install.yaml (including
AdobeIOManagementAPISDK, needed for the consumer's openwhisk invoke)
instead of two. Drop the IMS credentials bullet: those are synced
automatically by aio-commerce-lib-app once the APIs are subscribed,
not a separate manual prerequisite.
Drop the invented rationale for AdobeIOManagementAPISDK.
App Builder workspaces cap the number of event registrations. Routing
several events to one action keeps a many-event app under that limit
instead of spending a registration per event.
Removed the overrides section and added includes to the files section.
@iivvaannxx
iivvaannxx force-pushed the CEXT-6482/event-consumer-sample-impl branch from 5759cdd to 382c7e0 Compare July 27, 2026 10:06
@iivvaannxx

Copy link
Copy Markdown
Contributor Author

should we integrate aio-lib-telemetry?
is this pattern supported?

Meging this as agreed offline, we can integrate telemetry in the future. I have some things I want to do in the lib as soon as priorities allow, I think we can reconsider integration then.

@iivvaannxx
iivvaannxx merged commit 4b6bb27 into main Jul 27, 2026
1 check 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.

2 participants