Friday, November 27, 2009

WCF Channels

WCF Applications communicate by sending messages across channels.

There are two types of channels: Transport Channels and Protocol Channels. Transport channels sit at the lowest layer and provide the actual transport for messages. Protocol channels provide security, transactions, sessions, and message reliability.

Channels are layered upon one another, to create a channel stack. Bindings represent channel stack configurations, and simply the process of creating and referencing channel stacks.

The 3 communication patterns:
  • One-way
  • Request-Response
  • Duplex
are supported by 10 different channel shapes. There are actually 5 different shapes, each with 2 versions (one that supports sessions, and one that does not. Here are the 5 shapes:
  • IOutputChannel (IOutputSessionChannel). Supports one-way communication.
  • IInputChannel (IInputSessionChannel). Supports one-way communication.
  • IDuplexChannel (IDuplexSessionChannel). Supports duplex communication.
  • IRequestChannel (IRequestSessionChannel). Supports request-response communication.
  • IResponseChannel (IResponseSessionChannel). Supports request-response communication.
Channel listeners and channel factories will listen for messages.

Channel listeners can be closed without closing down the channel on which they were listening.

Channel factories are responsible for closing down their channels.

ICommunication object is the basis of all communication objects in WCF, which includes channels, channel factories, and channel listeners. Communication objects go through states: Created, Opening, Opened, Closing, Closed, and Faulted. Events are thrown when the Communication object transitions between these states.

No comments:

Post a Comment