Enterprise Integration Patterns
Conversation Patterns
Conversation Patterns
Consult DirectoryConversation Patterns » Discovery

A participant wants to initiate a conversation.

How can a conversation initiator find a partner across a large network without flooding the network with requests?

The initiator consults a directory, which refers it to one or more appropriate participants. Available participants register with the directory upfront.

The Consult Directory conversation involves the following participants:

In order to select an appropriate conversation partner, the directory has to provide a language for the initiator to express what type of partner it desires. Common strategies include:

A service directory is only useful if it keeps up-to-date with which available conversation partners. Most directories use Services Register in Directory or Directory Finds Services strategies [PLoPD5] to maintain a relevant list of participants. Alternatively, new participants can be entered by hand. The more frequently services appear or disappear, the more difficult it is for the directory to stay in sync with the real state of the network, favoring a Dynamic Discovery approach.

In order to use Consult Directory, an initiator must know how to contact the directory. This can be achieved through Dynamic Discovery or Advertise Availability as the number of directories tends to be small and fairly stable.

Because queries to the directory may be expensive, conversation initiators frequently cache results of previous inquiries. This approach reduces traffic on the directory but increases the likelihood that the initiator operates with out-of-date information. This approach is most viable in networks where service discovery is frequent, but services join or depart infrequently. A connection error on initial connect to the conversation partner helps identify outdated cached information.

Related patterns: Dynamic Discovery, Advertise Availability

Creative Commons Attribution License

You can reuse the following elements under the Creative Commons Attribution license: pattern icon, pattern name, problem and solution statements (in bold), and the sketch. Other portions are protected by copyright.