Query Fetcher¶
Outbound port for asynchronously fetching query results.
QueryFetcher provides an application-layer abstraction for retrieving data
by dispatching query messages through a MessageBus. It supports CQRS-style
architectures where queries are processed independently of commands.
Responsibilities:
- Forward queries to the message bus.
- Return the result of the query execution.
Non-Responsibilities:
- Define caching or projection logic.
- Guarantee consistency between read and write models.
query_fetcher
¶
Outbound port for asynchronously fetching query results.
QueryFetcher provides an application-layer abstraction for retrieving data
by dispatching query messages through a MessageBus. It supports CQRS-style
architectures where queries are processed independently of commands.
Responsibilities
- Forward queries to the message bus.
- Return the result of the query execution.
Non-Responsibilities
- Define caching or projection logic.
- Guarantee consistency between read and write models.
QueryFetcher
¶
Bases: OutboundPort[Query, QueryFetcherResult]
Outbound port for dispatching query messages.
The QueryFetcher abstracts query execution through a MessageBus. It does
not apply any interpretation to the returned data; shaping is the query
handler’s responsibility.
Source code in src/forging_blocks/application/ports/outbound/query_fetcher.py
fetch(query: Query) -> QueryFetcherResult
async
¶
Fetch the result of a query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
Query
|
The query instance. |
required |
Returns:
| Type | Description |
|---|---|
QueryFetcherResult
|
Any result returned by the underlying query handler. |
Notes
- Asynchronous execution.
- Data shape is determined by the handler responsible for the query.