Here's a cheat sheet for the different parts of the messaging framework and their responsibilities.
- Hosting layer
- Hosting environment. Provides a process for the service to live inside. Standard choices are console applications, NT services, and IIS.
- 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.
- Service layer
- 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.
- Proxy. Used by clients to map between the calls against the interface contract of the service and messages exchanged with the service.
- 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.
- 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.
- 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.
- Channel layer
- 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.
- Messaging layer
- Message encoder. Translates between the logical message format and a physical stream of bytes that can be transmitted across the network.
- Stream upgrades. An optional, client-initiated transformation of the physical stream of bytes before it is sent to the network transport.
- Transport. Creates or accepts client connections to the service. Sends or receives data across the network.
Next time: Inside the Standard Bindings: NetMsmq