## Discovery Protocols

### Overview

A discovery protocol builds a connection to a message broker in two steps, as follows:

1. Obtain a list of available broker endpoints (represented by URIs).

2. Connect to an endpoint randomly selected from the given list.

Discovery protocols are particularly useful for clients that connect to a cluster of message brokers.

### Summary of discovery protocols

Table 1.1 describes the discovery protocols that clients can use.

Table 1.2. Summary of Discovery Protocols

Protocol | Sample URL | Description
--- | --- | ---
Failover | `failover://(``uri1``,...,``uriN``)?``TransportOptions` | Configure clients to connect to one of the broker endpoints from the URI list, `uri1``,...,``uriN`. The transport options, `?``TransportOptions`, are specified in the form of a query list. If no transport options are required, you can omit the parentheses and the question mark, `?`.
Discovery | `discovery://(``DiscoveryAgentUri``)?``TransportOptions` | Configure clients to connect to one of the broker endpoints from a URI list that is dynamically discovered at runtime, using a discovery agent. The discovery agent URI, `DiscoveryAgentUri`, is normally a multicast discovery agent—for example, `multicast://default`.

### Discovery agents

The discovery protocol supports a number of discovery agents, which are also specified in the form of a URI. For details of the supported discovery agents, see Discovery Agents .

| Note
Although discovery agent URIs look superficially like transport URIs, they are not the same thing. A discovery agent URI can only be used in certain contexts and cannot be used in place of a transport URI.