You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Manuel Teira <mt...@tid.es> on 2007/06/06 17:30:45 UTC

AMQ 4.1.1 and TransportConnector brokerName

Hello.

My aim is to be able to have different clusters (JDBC master-slave) 
running in the same local network. I also want to be able to discover 
the running nodes from the clients, and so I was using a discoverUri 
(multicast://default) in the TransportConnector and the proper 
configuration for the clients. But to be able to isolate the different 
clusters, I think that I need to use different discoveryUris.

The first question is about the meaning of that uri multicast://default. 
Is that the same than using:

public static final String 
DEFAULT_DISCOVERY_URI_STRING="multicast://239.255.2.3:6155";

?

I've also seen that there's a property in the MulticastDiscoveryAgent 
called group. Its default value is 'default', is that related with the 
'default' token in the URI?

I wonder if URIs like multicast://<token> using different tokens for the 
different clusters should be enough to discriminate them. This is 
related with the following question:


Looking at the source code, it seems that the multicast code  is using 
the brokerName of the TransportConnector to be able to discriminate 
different clusters, as the packet payload has something like:

           String payload=getType();
            payload+=started.get()?ALIVE:DEAD;
            payload+=DELIMITER+brokerName+DELIMITER;
            payload+=selfService;

in org.apache.activemq.transport.discovery.multicast.MulticastDiscoveryAgent

But while starting; I get a warning that seems to be written from 
MulticastDiscoveryAgent.start()

            if (brokerName == null || brokerName.length()==0){
                log.warn("brokerName not set");
            }

Looking a little more in the code, it seems that the brokerName should 
be set by org.apache.activemq.broker.TransportConnector, before starting 
the DiscoveryAgent, its start() method says:

        if( da!=null ) {
            da.setBrokerName(getBrokerInfo().getBrokerName());
            da.registerService(getConnectUri().toString());
            da.start();
        }

So, the brokerName is the one in the BrokerInfo private instance of the 
TransportConnector, that is set using 
TransportConnector.setBrokername(String brokerName)

This is what I have in the xml configuration file:

<transportConnector brokerName="test" name="default" 
uri="tcp://localhost:61625" discoveryUri="multicast://224.1.2.3:6255"/>

In the activeMQ log, I see how spring is aware of the brokerName 
property, and it seems to set it:


[DEBUG][2007-06-06 
17:03:13,266][main][org.springframework.beans.CachedIntrospectionResults] 
Caching PropertyDescriptors for class 
[org.apache.activemq.broker.TransportConnector]
...

[DEBUG][2007-06-06 
17:03:13,267][main][org.springframework.beans.CachedIntrospectionResults] 
Found bean property 'brokerName' of type [java.lang.String]
...

[DEBUG][2007-06-06 
15:37:25,748][main][org.springframework.beans.BeanWrapperImpl] About to 
invoke write method [public void 
org.apache.activemq.broker.TransportConnector.setBrokerName(java.lang.String)] 
on object of class [org.apache.activemq.broker.TransportConnector]
[DEBUG][2007-06-06 
15:37:25,748][main][org.springframework.beans.BeanWrapperImpl] Invoked 
write method [public void 
org.apache.activemq.broker.TransportConnector.setBrokerName(java.lang.String)] 
with value of type [java.lang.String]

But, anyway, I'm getting multiple warnings like this:


[WARN ][2007-06-06 
15:37:27,459][main][org.apache.activemq.transport.discovery.multicast.MulticastDiscoveryAgent] 
brokerName not set


Perhaps they are from different MulticastDiscoveryAgents than the one 
bound to the TransportConnector?


So, please. Could you explain or direct me to some information source 
where I could learn how to write a proper multicast URI, and what is the 
meaning of its fields?

Thanks a lot.