Coreex Command Subscribe E2e
ASecurityAdd the receiving/handling of a command end-to-end: command contract (owned here), optional persistence, application service, command subscriber, the dedicated keyed queue receiver + subscriber + hosted service in the Subscribe host, Service Bus topology in Test.Common, Subscribe tests, and Aspire E2E. USE FOR: this domain must accept and act on a command addressed to it (queue `{Destination}-{this-domain}`) and the developer wants code, host wiring, infrastructure, tests and Aspire in one gu...
- 29 stars
- 0 votes
- 0 copies
- 1 view
- Added November 9, 2026
Security analysis
100/100Pro scans all 2 files and shows the line behind each finding
npx -y skills add Avanade/CoreEx --skill coreex-command-subscribe-e2e --agent claude-codeAre you the author of Coreex Command Subscribe E2e?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/avanade-coreex-command-subscribe-e2e)---
name: coreex-command-subscribe-e2e
description: "Add the receiving/handling of a command end-to-end: command contract (owned here), optional persistence, application service, command subscriber, the dedicated keyed queue receiver + subscriber + hosted service in the Subscribe host, Service Bus topology in Test.Common, Subscribe tests, and Aspire E2E. USE FOR: this domain must accept and act on a command addressed to it (queue `{Destination}-{this-domain}`) and the developer wants code, host wiring, infrastructure, tests and Aspire in one guided workflow. DO NOT USE FOR: subscribing to an event (use coreex-subscriber-e2e), sending a command (use coreex-command-publish-e2e), or subscribing to another domain's command (never valid — a command is consumed only by its owning domain)."
argument-hint: "Optional: command entity + action (e.g. reservation confirm), payload or key-only, the action it triggers, whether state is persisted, and who publishes it (in this AppHost or external)"
tags: ["coreex", "command", "subscribe", "subscriber", "service-bus", "queue", "end-to-end", "vertical-slice", "aspire", "messaging"]
---
<!--
AI workflow asset — dual-audience notice:
- In the Avanade/CoreEx repository: this file is the authored source. Edit it here.
- In a consumer repository: this file was generated by `dotnet new coreex-ai` (or refreshed via
`dotnet new coreex-ai --force` / the `/coreex-docs-sync` skill). Do not hand-edit it directly —
propose the change upstream in Avanade/CoreEx instead, then refresh once it is released.
-->
# CoreEx: Subscribe to a Command (End-to-End)
Guides you through making a domain **receive and act on a command**: the contract it owns, the handler, the **dedicated command-queue receiver** in the Subscribe host, the broker topology, the tests and the Aspire E2E — all context gathered once.
## Events vs Commands — decide first
| | **Event subscriber** (`coreex-subscriber-e2e`) | **Command subscriber** (this skill) |
|---|---|---|
| Source | Shared **topic**, this domain's subscription | This domain's **queue** `{Destination}-{this-domain}` (e.g. `contoso-products`) |
| Contract owner | The publisher | **This domain** — it defines subject + payload; publishers conform |
| Host wiring | Receiver `receiver-events` → `subscriber-events` → `hosted-subscriber-events` | **Second** receiver `receiver-commands` → `subscriber-commands` → `hosted-subscriber-commands` |
| Failure semantics | Usually tolerant (other domains' events you don't care about are ignored) | Explicit `ErrorHandler` for expected business outcomes; never silently drop a command |
A domain **never** subscribes to another domain's command queue. If the message is addressed to someone else, stop.
## When to Use
- "Products must handle a `reservation confirm` command sent by Shopping"
- Adding a command handler to a Subscribe host that already handles events (or has no command queue yet)
- The developer wants contract + handler + wiring + topology + tests + Aspire in one pass
## When Not to Use
- Reacting to an event — `coreex-subscriber-e2e`
- Sending a command — `coreex-command-publish-e2e`
- Creating the Subscribe host itself — `coreex-scaffold`
## Workflow Overview
1. **Read Feature Configuration** — `messaging-provider`, `data-provider` (`SqlServer` / `Postgres` / `Cosmos` / `None`), `rop-enabled`, `outbox-enabled`.
2. **Inspect the host** — is the existing event receiver already keyed? Is there already a command receiver? (Retrofit rules in the workflow.)
3. **Interview** — resolve recorded decisions first, then ask only unresolved behavioral/design questions one at a time using the available interaction mechanism. Present one compact plan and wait for approval unless the user's request already authorizes implementation; approval remains valid unless scope changes.
4. **Execute L1 sequence** (table below).
5. **Host wiring + topology + tests + Aspire.**
6. **Validate** — build, Subscribe tests, report.
For full step-by-step guidance see [`references/workflow.md`](references/workflow.md).
## L1 Sequence
| Step | Skill | Condition |
|---|---|---|
| 1 | [`coreex-contract`](../coreex-contract/SKILL.md) | Only if the command carries a payload (a key-only command needs no contract) |
| 2 | [`coreex-db-migration`](../coreex-db-migration/SKILL.md) + [`coreex-repository`](../coreex-repository/SKILL.md) | Only if the command persists new state (`data-provider ≠ None`) |
| 3 | [`coreex-validator`](../coreex-validator/SKILL.md) / [`coreex-policy`](../coreex-policy/SKILL.md) | Only if the payload/state needs validating |
| 4 | [`coreex-app-service`](../coreex-app-service/SKILL.md) | Always — the action the command triggers |
| 5 | [`coreex-subscriber`](../coreex-subscriber/SKILL.md) | Always — `[Subscribe("{parent}.{this-domain}.{entity}.{action}[.v1]")]` |
| 6 | *(inline — host wiring + topology)* | Always — command receiver in `Program.cs`; queue in Test.Common `ServiceBus` |
| 7 | [`coreex-test-subscribe`](../coreex-test-subscribe/SKILL.md) | Always — keyed `subscriber-commands` tests |
| 8 | [`coreex-aspire`](../coreex-aspire/SKILL.md) | When an `aspire/` folder exists |
## Key References
- [`/.github/instructions/coreex-event-subscribers.instructions.md`](/.github/instructions/coreex-event-subscribers.instructions.md) — subscriber conventions, keyed receivers, subject naming
- [`/.github/instructions/coreex-host-setup.instructions.md`](/.github/instructions/coreex-host-setup.instructions.md) — Subscribe host `Program.cs`
- [`/.github/instructions/coreex-tests.instructions.md`](/.github/instructions/coreex-tests.instructions.md) — Subscribe test conventions
- [`/.github/instructions/coreex-aspire.instructions.md`](/.github/instructions/coreex-aspire.instructions.md) — Aspire wiring
- Illustrative examples (CoreEx sample — not present in your project): [`ReservationConfirmSubscriber`](https://github.com/Avanade/CoreEx/blob/main/samples/src/Contoso.Products.Subscribe/Subscribers/ReservationConfirmSubscriber.cs), [Products.Subscribe `Program.cs`](https://github.com/Avanade/CoreEx/blob/main/samples/src/Contoso.Products.Subscribe/Program.cs) (two keyed receivers)
Files in this skill
- SKILL.md
- references/workflow.md
Attribution
Related skills
View all in databases →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.