Query Fetcher Port¶
query_fetcher_port
¶
Outbound port for asynchronously fetching query results.
Defines the QueryFetcherPort protocol for dispatching query messages
and returning their results. Supports CQRS-style architectures where
queries are processed independently of commands.
Responsibilities
- Abstract query dispatch from transport details.
Non-Responsibilities
- Define caching or projection logic.
- Guarantee consistency between read and write models.
QueryFetcherPort
¶
Bases: OutboundPort[Query[QueryPayloadType], QueryFetcherResult], Protocol
Protocol for dispatching query messages asynchronously.
Any object with an async fetch method that accepts a Query and
returns a result satisfies this protocol — no inheritance required.
Source code in src/forging_blocks/application/ports/outbound/query_fetcher_port.py
fetch(query: Query[QueryPayloadType]) -> QueryFetcherResult
async
¶
Fetch the result of a query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
Query[QueryPayloadType]
|
The query instance. |
required |
Returns:
| Type | Description |
|---|---|
QueryFetcherResult
|
Any result returned by the underlying query handler. |