Skip to content

Greyhound

Greyhound is our own implementation of a generic Mediator pattern. Essentially, it allows us to decouple the business logic by defining Requests, Responses, Handlers, and Notifications.

The Basics

With Greyhound, you issue requests and commands to get a response from a handler. You don’t care where the handler is, just that it processes your Request or Command and gives you a Response.

Requests and Commands

Requests and Commands are messages that ask for something to be done or tell the system to do something. They are the input to the system.

A Request is a message that asks for something to be returned. A Command is a message that tells the system to do something. A request is analogous to the “GET” method in HTTP/REST, and a command is analogous to “POST”, “PUT”, or “DELETE” in HTTP/REST.

The real technical difference is the type of response that is returned. A Request will return a Response<T> where T is the expected result type. A Command will return a non-generic Response.

Read more about Requests and Commands.

Responses

A Response is the result of a request or command. You should always check the IsSuccess property when you get back a Response. If this property is false, then the Error property will have details of the error.

Read more about Responses.

Request and Command Handlers

Handlers are the classes that do the actual work of processing a request or command and returning a Response<T> or Response, respectively.

Read more about Request and Command Handlers.

Notifications

Notifications are hooks raised by the system indicating that something has happened.

Read more about Notifications.