Discovery Transport Reference

Using ActiveMQ Classic > Configuring Transports > ActiveMQ Classic Connection URIs > Discovery Transport Reference

The Discovery Transport

The Discovery transport works just like the Failover transport, except that it uses a discovery agent to locate the list of uri to connect to. The Discovery transport is also used by the Fanout transport for discovering brokers to send a fanout message to.

Configuration Syntax

discovery:(discoveryAgentURI)?transportOptions

or

discovery:discoveryAgentURI

Note that to be able to use Discovery to find brokers, the brokers need to have the multicast discovery agent enabled on the broker.

To configure discovery in a Broker you should use the Xml Configuration. Here is an example of using discovery. Its basically something like the following (see the discoveryUri)

<broker name="foo">
  <transportConnectors>
    <transportConnector uri="tcp://localhost:0" discoveryUri="multicast://default"/>
  </transportConnectors>

  ...
</broker>
Transport Options
Option Name Default Value Description
reconnectDelay 10 How long to wait for discovery
initialReconnectDelay 10 How long to wait before the first reconnect attempt to a discovered url
maxReconnectDelay 30000 The maximum amount of time we ever wait between reconnect attempts
useExponentialBackOff true Should an exponential backoff be used btween reconnect attempts
backOffMultiplier 2 The exponent used in the exponential backoff attempts
maxReconnectAttempts 0 If not 0, then this is the maximum number of reconnect attempts before an error is sent back to the client
group default an identifier for the group to partition multi cast traffic among collaborating peers; the group forms part of the shared identity of a discovery datagram (since 5.2)
Example URI
discovery:(multicast://default)?initialReconnectDelay=100

Applying parameters to discovered transports

From 5.4, transport parameters in the URI will also be applied to discovered transports if they are prefixed with discovered.; For example, adding the discovered.connectionTimeout parameter to the URI will apply the parameter to every discovered TCP transport, even though this parameter is not a Discovery transport option.

Apache, ActiveMQ, Apache ActiveMQ, the Apache feather logo, and the Apache ActiveMQ project logo are trademarks of The Apache Software Foundation. Copyright © 2024, The Apache Software Foundation. Licensed under Apache License 2.0.