Skip to content

IRestHostSubscriber

IRestHostSubscriber represents the server-side contract of the RPC communication model.

It is responsible for receiving request messages and delegating processing to ASP.NET Core.


Responsibilities

The subscriber is responsible for:

  • receiving requests;
  • deserializing payloads;
  • invoking ASP.NET Core;
  • generating responses;
  • publishing responses.
graph LR

    RabbitMQ --> IRestHostSubscriber

    IRestHostSubscriber --> ASPNET

    ASPNET --> Response

Processing Model

The subscriber acts as a bridge between RabbitMQ and ASP.NET Core.

graph LR

    RabbitMQ --> Subscriber

    Subscriber --> ASPNET

    ASPNET --> Controller

    Controller --> Result

ASP.NET Core Integration

The ASP.NET Core pipeline remains responsible for:

  • routing;
  • model binding;
  • validation;
  • authorization;
  • controller execution.

This allows existing ASP.NET Core applications to participate in RPC communication with minimal changes.


Response Generation

After the ASP.NET Core pipeline completes execution, a response message is created and sent back through RabbitMQ.

sequenceDiagram

    participant RabbitMQ

    participant Subscriber

    participant ASPNET

    RabbitMQ->>Subscriber: Request

    Subscriber->>ASPNET: Execute

    ASPNET-->>Subscriber: Result

    Subscriber->>RabbitMQ: Response

Default Implementation

The RabbitMQ implementation provided by the framework is:

RestHostSubscriberBound

This implementation is documented in the next section.