Skip to content

IAsyncRestPublisher

IAsyncRestPublisher is the client-side contract used to initiate RPC requests.

It provides a request/response abstraction built on top of RabbitMQ messaging.


Responsibilities

The publisher is responsible for:

  • creating requests;
  • serializing payloads;
  • publishing requests;
  • waiting for responses;
  • correlating responses.
graph LR

    Request --> IAsyncRestPublisher

    IAsyncRestPublisher --> RabbitMQ

    RabbitMQ --> Response

Request Publication

The request publication process follows the same principles used by standard publishers.

sequenceDiagram

    participant Client

    participant Publisher

    participant RabbitMQ

    Client->>Publisher: Request

    Publisher->>RabbitMQ: Publish Request

Response Correlation

A response must be associated with the originating request.

Conceptually:

graph LR

    Request --> CorrelationId

    CorrelationId --> Response

This allows multiple concurrent requests to be processed safely.


Formatter Integration

IAsyncRestPublisher relies on IDataFormatter for request serialization and response deserialization.

graph LR

    IDataFormatter --> IAsyncRestPublisher

    IAsyncRestPublisher --> RabbitMQ

Error Handling

Typical failures include:

  • timeouts;
  • unavailable consumers;
  • transport failures;
  • serialization errors.

Applications should treat RPC calls as remote operations and design appropriate timeout and retry strategies.