Freigeben über


Discovery Concepts

                The last entry covered a simple discovery example. Before we get into more complex scenarios, let’s cover some of the core concepts behind WCF-Discovery. The entry below covers the main components, exposed functionality as well as the modes of operation of WCF-Discovery.

Discovery Components

components 
In any application architecture, there can be three types of components utilizing discovery. As the picture above shows, Discovery involves a client, a service, and/or a Discovery Proxy. Without resorting to strict definitions, here is how you can think of them and their capabilities:

  • A Client is an entity that is looking for services and utilizes the “DiscoveryClient” to search for them. A client may also host an “Announcement Service” if it wants to listen for announcements from services.
  • A Service is a WCF service that has endpoints which can be discovered. A Service adds a ServiceDiscoveryBehavior in the service host description, which enables it to respond to find requests from clients. A service may also host an announcement client if it wants to announce itself. 
  • A Discovery Proxy – This is a centralized repository that knows about services. This is a not a required component and its necessity is completely dependent on your use case. The framework does not include an implementation of a proxy; though it does provide the building blocks for you to easily create one. There are several uses for a Proxy and we’ll cover this component in detail in subsequent posts.

Discovery Functionality
The real key is, how can a Client become aware of a Service? As hinted at above, discovery functionality can be broken down into two areas: find/ resolve operations and announcements.

The find/resolve functionality is characterized by a client looking for a service. This can be broken down further into: Find and Resolves

  • Find: If a client is looking for a service based on criteria such as the service type, or some scopes, it sends out a Probe message. The recipient of the probe, either a service or a proxy responds back to the client with the appropriate service metadata.
  • Resolve: A resolve is used by client to locate a service based on its endpoint address. This is useful when the endpoint address is not network addressable.

Another functionality open to users is Announcements. In this case Services can announce themselves to the network and clients can be configured to listen for such announcements. In the default case a service sends out a hello message when it comes online and a bye message when going offline. This pattern is useful when a service wants to notify a recipient without having the recipient pinging the network periodically.

Operation Modes
There are two modes of operation for Discovery, Ad-Hoc mode and Managed mode.

  • In the Ad-Hoc mode a client sends the Probe/Resolve message over UDP multicast. The range of this message is limited to your subnet. Any service listening for such messages can pick it up and respond.
  • In Managed mode a client sends Probes and Resolves directly to the recipient, and it responds back with the endpoint metdata that matches.

Discovery Protocols

The WCF-Discovery product supports two versions of the WS-Discovery protocol. These include:

Currently the default is set to the WS-Discovery April 2005. Selecting the appropriate protocol is important depending on how you want to interop with other implementations of WS-Discovery. We'll cover protocols in depth later on.