Hello NestForge Microservices
What the microservices example includes and how it demonstrates pattern dispatch without a network transport.
Run the example
Section titled “Run the example”Example location:
examples/hello-nestforge-microservicesRun it from the repository root:
cargo run -p hello-nestforge-microservicesExample purpose
Section titled “Example purpose”This example demonstrates NestForge’s transport-neutral microservice layer without requiring HTTP, gRPC, or WebSockets at the edge.
Files included
Section titled “Files included”The example currently includes:
src/main.rssrc/app_module.rssrc/app_config.rssrc/microservices/mod.rssrc/microservices/patterns.rs
Recommended reading order
Section titled “Recommended reading order”Read the example in this order:
src/app_module.rssrc/microservices/patterns.rssrc/main.rs
What each file does
Section titled “What each file does”src/main.rs
Section titled “src/main.rs”Creates a testing module with TestFactory::<AppModule>, resolves the pattern registry,
constructs an in-process microservice client, sends a message, emits an event, prints the
result, and shuts the module down.
This is important because it demonstrates that the microservice layer is not tied to a specific external server.
src/app_module.rs
Section titled “src/app_module.rs”Registers:
AppConfigAppPatternsEventCounter
and exports them for the microservice runtime.
src/microservices/patterns.rs
Section titled “src/microservices/patterns.rs”Defines:
GreetingPayloadEventCounter- the
app.greetmessage pattern - the
app.bumpevent pattern
What users learn from this example
Section titled “What users learn from this example”- how to define message and event patterns
- how handlers resolve providers from
MicroserviceContext - how to test microservice workflows in-process
- how stateful side effects such as event counters can still use DI-managed providers
What to verify
Section titled “What to verify”When the example runs, verify:
- the testing module builds successfully
app.greetreturns a JSON payloadapp.bumpupdates the event counter- the module shuts down cleanly