Details
Description
There is currently no way to apply parameters to discovered brokers when using the fanout transport. The discovery transport allows this by calling DiscoveryTransport.setParameters(Map) in DiscoveryTransportFactory.createTransport(CompositeData). For example, the following URI would apply a connection timeout of 3 seconds to all discovered TCP transport brokers,
discovery:(multicast://default)?connectionTimeout=3000
The corresponding fanout URI would not apply the connection timeout to discovered TCP brokers,
fanout:(multicast://default)?connectionTimeout=3000
This functionality is requested as discovered brokers may become unreachable. In those circumstances, the default 30 connection timeout for the TCP transport can cause a considerable delay.
The attached patch is a proposed solution where both transports that use the discovery transport, failover and fanout, have a common code path in DiscoveryTransportFactory for creating a discovery transport. This code path sets the parameters consistently for both transports. (Although it relies on a new static method in DiscoveryTansportFactory and TransportFactory objects do not have static methods, FanoutTransportFactory was already making a static call to DiscoveryAgentFactory). The patch also has two new test cases, one for apply parameters and another for a minor fix where DiscoveryTransport should cache the added URI after the parameters are applied so that the same URI is removed in onServiceRemove().
This issue is created after discussion on the ActiveMQ Users discussion board,
http://old.nabble.com/Applying-Parameters-to-Discovered-Brokers-td29239157.html