Coreex Command Publish E2e
ASecurityAdd the sending/publishing of a command to another domain end-to-end: adapter (interface + Infrastructure implementation + wire DTO), application-service call site (outbox vs direct broker), destination routing (NamedDestinationProvider -> per-domain queue), Service Bus topology in Test.Common, API/Relay tests, and Aspire E2E. USE FOR: a domain must instruct another domain to do something (a command, not an event) and the developer wants code, infrastructure, tests and Aspire in one guided wo...
- 29 stars
- 0 votes
- 0 copies
- 3 views
- Added November 9, 2026
Works with
Security analysis
100/100Pro scans all 2 files and shows the line behind each finding
npx -y skills add Avanade/CoreEx --skill coreex-command-publish-e2e --agent claude-codeAre you the author of Coreex Command Publish E2e?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/avanade-coreex-command-publish-e2e)---
name: coreex-command-publish-e2e
description: "Add the sending/publishing of a command to another domain end-to-end: adapter (interface + Infrastructure implementation + wire DTO), application-service call site (outbox vs direct broker), destination routing (NamedDestinationProvider -> per-domain queue), Service Bus topology in Test.Common, API/Relay tests, and Aspire E2E. USE FOR: a domain must instruct another domain to do something (a command, not an event) and the developer wants code, infrastructure, tests and Aspire in one guided workflow. DO NOT USE FOR: publishing an event (fire-and-forget; use coreex-app-service — events go to the shared topic), receiving a command (use coreex-command-subscribe-e2e), or a synchronous request/response call to another domain (use coreex-adapter with a typed HTTP client)."
argument-hint: "Optional: target domain, command entity + action (e.g. products reservation confirm), payload or key-only, triggering operation, and whether the target domain is in this AppHost"
tags: ["coreex", "command", "publish", "outbox", "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: Publish a Command (End-to-End)
Guides you through making one domain **send a command** to another: the adapter that builds it, the transactional call site, the routing to the target's queue, the broker topology, the tests and the Aspire E2E — gathered in one interview so nothing is asked twice.
## Events vs Commands — decide first
| | **Event** | **Command** |
|---|---|---|
| Intent | "This happened" — reactive, fire-and-forget | "Do this" — addressed to **one** consumer |
| Built with | `EventData.CreateEventWith(...)` | `EventData.CreateCommand("{target-domain}", "{entity}", "{action}")` |
| Destination (`NamedDestinationProvider`) | Shared **topic** (`CoreEx:Events:Destination`) — every domain subscribes | **Queue** `{Destination}-{target-domain}` (e.g. `contoso-products`) — only the target sees it |
| Contract owner | Publisher | **Target** domain (`DomainName` = the owner of the message contract) |
If the developer means an event, stop and use `coreex-app-service` — nothing on this page applies.
## When to Use
- "Shopping must tell Products to confirm the reservation" — a domain instructs another domain
- A compensating command (cancel/undo) must be sent, possibly bypassing the outbox
- The developer wants code + broker topology + tests + Aspire covered in one pass
## When Not to Use
- Publishing an event — `coreex-app-service`
- Receiving/handling a command — `coreex-command-subscribe-e2e`
- A synchronous call that needs an answer — `coreex-adapter` (typed HTTP client)
## Workflow Overview
1. **Read Feature Configuration** — `messaging-provider` must be `ServiceBus`; `outbox-enabled` decides outbox vs direct; `rop-enabled` decides `Result<T>` vs exceptions.
2. **Verify routing** — `AddNamedDestinationProvider()` is registered in every host that publishes; migrate away from `AddFixedDestinationProvider` (it would send commands to the shared topic).
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. **Topology + tests + Aspire** — queue in Test.Common `ServiceBus`, API/Relay tests, `coreex-aspire`.
6. **Validate** — build, unit/integration tests, report.
For full step-by-step guidance see [`references/workflow.md`](references/workflow.md).
Both direct and outbox paths use the configured `IEventPublisher`; direct means no outbox, not raw SDK sending. Preserve custom publisher implementations/decorators and supported overrides. No-outbox apps need neither a database nor a relay merely to publish; add and await `PublishAsync(cancellationToken)` through CoreEx `ServiceBusPublisher` or the configured replacement. Raw SDK sends need a concrete documented requirement.
## L1 Sequence
| Step | Skill | Condition |
|---|---|---|
| 1 | [`coreex-adapter`](../coreex-adapter/SKILL.md) | Always — the adapter interface + implementation that builds the `EventData` command; the wire DTO for a payload lives in `Infrastructure/Clients/{Target}/` |
| 2 | [`coreex-app-service`](../coreex-app-service/SKILL.md) | Application call site — inside the transaction for outbox, awaited direct publishing without one, or an explicit compensation path |
| 3 | *(inline — Service Bus topology)* | Always — add the queue to Test.Common `ServiceBus.GetQueues()` |
| 4 | [`coreex-test-api`](../coreex-test-api/SKILL.md) | API call site — assert outbox or direct publisher as selected; Functions uses its capability's invocation/component tests |
| 5 | [`coreex-test-relay`](../coreex-test-relay/SKILL.md) | Outbox only — prove the relay delivers the command to the queue |
| 6 | [`coreex-aspire`](../coreex-aspire/SKILL.md) | When an `aspire/` folder exists — topology, consumer wiring, E2E |
## Key References
- [`/.github/instructions/coreex-application-services.instructions.md`](/.github/instructions/coreex-application-services.instructions.md) — unit of work, adapters
- [`/.github/instructions/coreex-repositories.instructions.md`](/.github/instructions/coreex-repositories.instructions.md) — adapter/client implementation conventions
- [`/.github/instructions/coreex-tests.instructions.md`](/.github/instructions/coreex-tests.instructions.md) — outbox assertions, relay tests, `Test.ResetAzureServiceBusAsync`
- [`/.github/instructions/coreex-aspire.instructions.md`](/.github/instructions/coreex-aspire.instructions.md) — Aspire wiring
- Illustrative examples (CoreEx sample — not present in your project): [`ProductAdapter`](https://github.com/Avanade/CoreEx/blob/main/samples/src/Contoso.Shopping.Infrastructure/Adapters/Products/ProductAdapter.cs) (`CreateConfirmReservationCommand`, `CancelReservationAsync`), [`BasketService.CheckoutAsync`](https://github.com/Avanade/CoreEx/blob/main/samples/src/Contoso.Shopping.Application/BasketService.cs), [relay queue test](https://github.com/Avanade/CoreEx/blob/main/samples/tests/Contoso.Shopping.Test.Relay/RelayTests.cs)
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.