O'Reilly logo

Programming WCF Services by Juval Lowy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Events

The basic WCF callback mechanism does not indicate anything about the nature of the interaction between the client and the service. They could be equal peers in a commutative interaction, each calling and receiving calls from the other.

However, the canonical use for duplex callbacks is with events. Events allow the client or clients to be notified about something that occurred on the service side. The event may result from a direct client call, or it may be the result of something the service monitors. The service firing the event is called the publisher, and the client receiving the event is called the subscriber. Events are a required feature in almost any type of application, as shown in Figure 5-2.

A publishing service can fire events at multiple subscribing clients

Figure 5-2. A publishing service can fire events at multiple subscribing clients

While events in WCF are noting more than callback operations, by their very nature events usually imply a looser relationship between the publisher and the subscriber, compared with the relationship between a client and a service. When dealing with events, the service typically publishes the same event to multiple subscribing clients. The publisher often does not care about the order of the invocation of the subscribers. The publishing service usually does not care about errors the subscribers might have while processing the events. All the publisher knows is that it should deliver ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required