Response Flow¶
This page describes how responses travel back to the original requester.
High-Level Flow¶
sequenceDiagram
participant ASPNET
participant Subscriber
participant RabbitMQ
participant Publisher
participant Client
ASPNET-->>Subscriber: Response
Subscriber->>RabbitMQ: Publish Response
RabbitMQ-->>Publisher: Deliver Response
Publisher-->>Client: Response
Step 1 - ASP.NET Core Produces Response¶
Controller execution produces a result.
Example:
public sealed record CalculatePriceResponse(
decimal TotalPrice);
Step 2 - Response Serialization¶
The response object is serialized using IDataFormatter.
graph LR
Response --> IDataFormatter
IDataFormatter --> Payload
Step 3 - Response Publication¶
The subscriber publishes the response message.
graph LR
Subscriber --> RabbitMQ
Step 4 - Response Correlation¶
The publisher matches the response to the original request.
graph LR
Request --> CorrelationId
CorrelationId --> Response
Correlation identifiers are critical because multiple requests may be processed concurrently.
Step 5 - Client Receives Response¶
The response is deserialized and returned to the caller.
graph LR
Payload --> IDataFormatter
IDataFormatter --> Response
The application receives the final result as if it were a local request/response interaction.
Timeout Handling¶
Applications should always assume that responses may fail to arrive.
Common causes include:
- network failures;
- broker failures;
- application failures;
- timeout expiration.
Timeout policies should be configured according to business requirements.