Here's a cheat sheet for the different parts of the messaging framework and their responsibilities.

  1. Hosting layer
    1. Hosting environment. Provides a process for the service to live inside. Standard choices are console applications, NT services, and IIS.
    2. Activation. The service is either always running or has a listener inside the hosting environment that activates the service when a message arrives. Activation solves the problem of restarting the service after it fails but adds the new problem of maintaining the service state between invocations.
  2. Service layer
    1. Service contract. Defines a collection of logical operations that the service can perform. Each operation has a test that determines whether an incoming message can be interpreted for use with that operation.
    2. Proxy. Used by clients to map between the calls against the interface contract of the service and messages exchanged with the service.
    3. Dispatcher. Used by the service to map between calls against the interface contract of the service and messages exchanged with the service. The dispatcher is responsible for selecting the correct service operation to invoke when a message arrives.
    4. Message pump. Moderates the flow of messages from the channel layer to the service. The message pump needs to continuously accept new client connections and messages but throttle itself back when the service becomes overloaded.
    5. Service endpoints. Projects the service out to clients by providing an instance of the channel layer. Each endpoint project an independent instance allowing the same service to be associated with multiple channel stacks and networking configurations.
  3. Channel layer
    1. Channel stack. A composable pipeline through which messages flow between the network and application. The channel stack can send its own protocol and infrastructure messages to hide the network configuration from the application.
  4. Messaging layer
    1. Message encoder. Translates between the logical message format and a physical stream of bytes that can be transmitted across the network.
    2. Stream upgrades. An optional, client-initiated transformation of the physical stream of bytes before it is sent to the network transport.
    3. Transport. Creates or accepts client connections to the service. Sends or receives data across the network.

Next time: Inside the Standard Bindings: NetMsmq