Brewtiful Beans Learns AT4DX, Part 10: The AEP Toolbox
Sales has one more Account workflow for Joe. He knows which package should own it and which shared selector and domain to use. The architecture is no longer the puzzle. The familiar files and metadata still take time to create.
Joe has already written the rules by hand. This time, he wants help with the repeatable scaffolding, plus a way to catch a bad binding before it turns into a puzzling test failure.
That is the job of Simply AEP, a Salesforce CLI plugin for Apex Enterprise Patterns, including AT4DX.
After this post, you can:
- Generate the common fflib or AT4DX layers for an SObject or service.
- Use Simply AEP to create, inspect, update, and validate AT4DX metadata.
- Simulate how an AT4DX platform event subscription matches an event.
Keep the Wiki Open
The trail is the on-ramp. The AT4DX wiki is the reference to open when you need the exact shape of a pattern. These pages go deeper on the ideas covered in this series:
- Intro and DI Concepts: the vocabulary and why injection exists.
- Architecture Layers: the package graph and placement decision tree from Part 3.
- Application Factory Injection: the four factories and their binding records.
- Selector Field Injection and Selector Method Injection: the details behind Parts 5 and 6.
- Domain Process Injection: sequences, Criteria, Actions, and the async pattern from Part 7.
- Multi-App Single Org Example: the three-team capstone from Part 8.
- Testing Patterns: the mock patterns from Part 9.
- Reference: metadata types, key classes, and common errors.
Use the posts to learn the route, then keep the wiki nearby when you apply the patterns in an org.
Generate the familiar pieces
Joe installs the plugin. The examples use myOrg as the CLI org alias. He asks it for the parts his Account work needs:
sf plugins install @simplysf/simply-aep
sf simply aep generate \
--target-org myOrg \
--sobject Account \
--flavor at4dx \
--selector --domain --unit-of-work
sf simply aep generate service \
--target-org myOrg \
--service-basename SalesPipeline \
--flavor at4dx
The first command can generate the selector, domain, and Unit of Work layers together. The service command scaffolds a service facade, interface, implementation, exception, test, and its AT4DX binding. The generator also has individual commands for selector, domain, and Unit of Work, and it supports an fflib flavor as well as at4dx.
Joe still decides where those classes belong and what the service should do. The generator gets the structure started; it does not know Brewtiful Beans’ package boundaries or business rules. He reads the output before he moves it into the right package.
Keep the bindings in shape
The classes are only part of the work. AT4DX uses metadata to connect factories to implementations, trigger events to Criteria and Actions, and selectors to field sets. Simply AEP has a command family for each of those jobs:
sf simply aep at4dx bindingmanages Service, Selector, Domain, and Unit of Work factory bindings.sf simply aep at4dx domain-process-bindingmanages the Criteria and Action bindings from Part 7.sf simply aep at4dx field-set-inclusionmanages the fieldsets that extend a shared selector’s query fields.
Each family supports creating, listing, updating, and validating its records. The commands can work with local Salesforce DX source or a connected org. A create or update can validate the resulting metadata before writing it, and the validation commands can scan the configuration directly.
Joe can inspect the configured factory winners and run the relevant checks before he asks for a review:
sf simply aep at4dx binding list --target-org myOrg --effective-only
sf simply aep at4dx binding validate --target-org myOrg
sf simply aep at4dx domain-process-binding validate --target-org myOrg
sf simply aep at4dx field-set-inclusion validate --target-org myOrg
binding list can show the effective Service and Selector bindings instead of every shadowed record. The validators look for wiring problems, such as an invalid SObject reference or a domain-process binding whose declared process context conflicts with its trigger-operation or domain-method-token fields. That feedback is useful, but it cannot tell whether a Criteria expresses the right business rule. Joe still owns that part.
Check the event route before it runs
Brewtiful Beans may also route platform events through AT4DX’s Platform Event Distributor. A subscription connects an event bus and matching rule to a consumer. Simply AEP can create, list, update, and validate those subscription records, too.
Suppose Joe wants to check a hypothetical Account_Change__e event before testing the full flow. The simulator reads the subscriptions and shows which consumers would receive the event, which would not, and why:
sf simply aep at4dx platform-event-subscription simulate \
--target-org myOrg \
--event-bus Account_Change__e \
--category Finance \
--event-name AccountUpdated
This does not publish an event. It checks the distributor’s matching decision against the event details Joe supplied. The subscription validator can also catch configuration that would otherwise fail quietly at runtime, such as a matcher rule that needs a category the subscription leaves blank.
The Simply AEP command reference covers each command and its flags. Joe can use it to create or update metadata locally, inspect what is already configured, or validate a connected org.
Bring the bindings into the editor
Joe does not have to leave VS Code to explore AT4DX wiring. The Simply AT4DX extension adds a Domain Binding Explorer for inspecting the domain bindings in his Salesforce project. That gives him an editor-side view of the wiring he can create and validate with Simply AEP. The CLI remains useful for scripted checks and connected-org work; the explorer makes the configuration easier to navigate while he is working in the codebase.
The explorer shows Joe what is configured. Simply AEP creates, updates, and validates the metadata. He moves between the two as the task requires.
Give an agent the AT4DX context
Joe can also bring an AI coding agent into the workflow with the AT4DX Agent Skills. The skills give an agent focused guidance for working with AT4DX conventions and artifacts, so it can help with implementation while keeping the framework’s patterns in view.
An agent skill is guidance, not a review. Joe still checks the generated code and metadata, confirms the package boundaries, and runs the project’s tests. The skill can help the agent make useful suggestions, but it cannot know which business rule Brewtiful Beans should adopt.
What stays with Joe
The generator writes the scaffolding. The binding commands flag configuration that will not resolve as intended. The event simulator shows where a hypothetical event would go, and the Domain Binding Explorer lets him inspect the wiring in VS Code. His coding agent gets focused guidance from the AT4DX skills.
None of these tools picks the package, writes the business rule, or judges whether the design makes sense. Joe still makes those calls. The tools shorten the path from those decisions to a reviewable implementation.
Keep the architecture in your head; let the CLI handle the repeatable setup and checks.
Check Your Brew
1. What should Joe expect Simply AEP’s generator to decide for him?
- A. Which package owns the Sales workflow
- B. The business rule for classifying Accounts
- C. The standard class and metadata scaffolding for the selected fflib or AT4DX layer
- D. The sequence number that will avoid every other team’s bindings
Reveal the answer
C. The generator creates framework scaffolding. Joe still chooses package ownership, business behavior, and the right binding configuration.
2. Which command family should Joe use to inspect or validate a Criteria/Action trigger binding?
- A.
sf simply aep at4dx binding - B.
sf simply aep at4dx domain-process-binding - C.
sf simply aep at4dx field-set-inclusion - D.
sf simply aep generate service
Reveal the answer
B. Domain-process bindings connect Criteria and Actions to trigger or domain-method execution. Factory bindings and selector field-set inclusions have their own command families.
3. What does platform-event-subscription simulate do?
- A. Publishes a real platform event to the org
- B. Generates a new event bus and consumer class
- C. Runs every consumer once so Joe can compare their output
- D. Shows which configured consumers would match a hypothetical event and why
Reveal the answer
D. The simulator checks the distributor’s resolution for the event details Joe supplies; it does not publish that event.
You did it
Joe began by asking who should own a selector. He now asks the same question about domains, services, bindings, and event consumers. The tool can make the repeated work quicker, but that judgment is still his.
While Joe felt the problem that at4dx in his bones, understanding the solution and remembering how to implement it did not come overnight, even with a few extra espressos. Absorbing this takes time to brew, like a good pour-over. He hopes you take some time to savour the flavor and enjoy the latte art.