feat: add service activator pattern support#300
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Test Results 1 files 1 suites 2m 39s ⏱️ Results for commit 60d13af. |
There was a problem hiding this comment.
Pull request overview
Adds the Service Activator enterprise integration pattern across the PatternKit stack: a new runtime fluent API (PatternKit.Core), Roslyn source generator + attributes (PatternKit.Generators*), DI-importable production-shaped inventory example (PatternKit.Examples), and accompanying tests/docs/catalog entries.
Changes:
- Introduces
ServiceActivator<TRequest, TResponse>runtime API with a fluent builder and activation result type. - Adds
[GenerateServiceActivator]/[ServiceActivatorHandler]attributes plusServiceActivatorGenerator(with diagnostics + generator tests). - Adds inventory service-activator example, DI registration via
AddPatternKitExamples(), and updates pattern/example catalogs + docs TOCs.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/PatternKit.Tests/Messaging/Activation/ServiceActivatorTests.cs | Adds runtime unit coverage for fluent service activator activation and validation. |
| test/PatternKit.Generators.Tests/ServiceActivatorGeneratorTests.cs | Verifies factory generation output and generator diagnostics for service activators. |
| test/PatternKit.Generators.Tests/AbstractionsAttributeCoverageTests.cs | Extends attribute-coverage suite to include the new generator attributes + defaults/guards. |
| test/PatternKit.Examples.Tests/ProductionReadiness/PatternKitPatternCatalogTests.cs | Updates production-readiness expectations to include the new pattern and counts. |
| test/PatternKit.Examples.Tests/Messaging/InventoryServiceActivatorExampleTests.cs | Adds end-to-end example verification for fluent, generated, and DI-imported service activator usage. |
| src/PatternKit.Generators/Messaging/ServiceActivatorGenerator.cs | Implements the incremental generator that emits ServiceActivator<,> factories and diagnostics. |
| src/PatternKit.Generators/AnalyzerReleases.Unshipped.md | Registers new generator diagnostic IDs (PKSVA001–003). |
| src/PatternKit.Generators.Abstractions/Messaging/ServiceActivatorAttributes.cs | Adds new public generator attributes for service-activator factory generation and handler marking. |
| src/PatternKit.Examples/ProductionReadiness/PatternKitPatternCatalog.cs | Registers the Service Activator pattern entry with docs/source/tests/example pointers. |
| src/PatternKit.Examples/ProductionReadiness/PatternKitExampleCatalog.cs | Adds a new example descriptor for “Inventory Service Activator”. |
| src/PatternKit.Examples/Messaging/InventoryServiceActivatorExample.cs | Adds a production-shaped inventory reservation example with fluent + source-generated activator paths and IServiceCollection import. |
| src/PatternKit.Examples/DependencyInjection/PatternKitExampleServiceCollectionExtensions.cs | Wires the new example into AddPatternKitExamples() and adds an example service descriptor/registration. |
| src/PatternKit.Core/Messaging/Activation/ServiceActivator.cs | Introduces the core runtime Service Activator API and its result type. |
| docs/patterns/toc.yml | Adds Service Activator to the patterns navigation TOC. |
| docs/patterns/messaging/service-activator.md | Adds the Service Activator pattern documentation page. |
| docs/patterns/messaging/README.md | Adds an overview entry/link for Service Activator within messaging patterns. |
| docs/guides/pattern-coverage.md | Adds Service Activator to the coverage matrix (runtime + generator). |
| docs/generators/toc.yml | Adds Service Activator generator docs to the generators TOC. |
| docs/generators/service-activator.md | Adds generator usage docs and lists diagnostics. |
| docs/generators/index.md | Adds Service Activator to the generator index table. |
| docs/examples/toc.yml | Adds the Inventory Service Activator example to the examples TOC. |
| docs/examples/inventory-service-activator.md | Adds the example documentation page for inventory service activation. |
| docs/examples/index.md | Adds the new inventory service activator example to the examples index list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| public sealed class ServiceActivatorResult<TRequest, TResponse> | ||
| { | ||
| public ServiceActivatorResult( | ||
| string activatorName, | ||
| Message<TRequest> request, | ||
| Message<TResponse> response) | ||
| => (ActivatorName, Request, Response) = (activatorName, request, response); | ||
|
|
| .Handle((message, context) => Message<InventoryReservationResult>.Create(result)) | ||
| .Build(); | ||
|
|
||
| var response = activator.Activate(Message<InventoryReservationRequest>.Create(request)); |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #300 +/- ##
==========================================
+ Coverage 90.36% 96.04% +5.68%
==========================================
Files 420 424 +4
Lines 35581 35733 +152
Branches 5039 5064 +25
==========================================
+ Hits 32151 34321 +2170
+ Misses 1514 1412 -102
+ Partials 1916 0 -1916
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🔍 PR Validation ResultsVersion: `` ✅ Validation Steps
📊 ArtifactsDry-run artifacts have been uploaded and will be available for 7 days. This comment was automatically generated by the PR validation workflow. |
Code Coverage |
Closes #294.\n\nAdds the Service Activator enterprise integration pattern with fluent runtime support, source generator attributes and factory generation, TinyBDD coverage, production-shaped DI example, and catalog/docs entries.