Here is the setup:
ActiveMQ 4.0.2 (I know it's old, but need to try to get it working before
upgrading, seems backwards logic, but short on time)

4 brokers running locally on a Windows machine, Java code connecting to
brokers, i.e. connect to transport with this code from java:
props.setProperty(Context.PROVIDER_URL,"tcp://localhost:61616");
this connection works great and everything is fine, but I want to provide
redundancy if this connection were to fail, so I am trying this.....

in xml config for brokers, I want to provide a network of brokers that can
work as a cluster, or will work if 1 fails.  My preference would be to
randomly connect to 1 of the brokers in the network, and failover to any
other 1 if possible.  It appears I have hardcoded connection to this 1, so
not sure how to randomly connect, unless I modify my java code to randomly
connect (is this the best approach?).

When I do connect to the 61616 port on localhost, I have configured
networkConnector to other ports statically.  My log shows this when starting
up brokers.
ACTIVEMQ_HOME: C:\DIVAS Snapshot\activemq-4.0.2 Broker1\bin\..
Loading message broker from: xbean:activemq.xml
INFO  BrokerService                  - ActiveMQ 4.0.2 JMS Message Broker
(broker
1) is starting
INFO  BrokerService                  - For help or more information please
see:
http://incubator.apache.org/activemq/
INFO  TransportServerThreadSupport   - Listening for connections at:
tcp://MAVS0
1:61616?connectionTimeout=0
INFO  TransportConnector             - Connector default Started
INFO  NetworkConnector               - Establishing network connection
between f
rom vm://broker1?network=true to
failover:(tcp://localhost:61617)?maxReconnectDelay
=1000
INFO  TransportConnector             - Connector vm://broker1 Started
INFO  NetworkConnector               - Establishing network connection
between f
rom vm://broker1?network=true to
failover:(tcp://localhost:61618)?maxReconnectDelay
=1000
INFO  NetworkConnector               - Establishing network connection
between f
rom vm://broker1?network=true to
failover:(tcp://localhost:61619)?maxReconnectDelay
=1000
INFO  NetworkConnector               - Network Connector host1 and host2 and
hos
t3 and host4 and host5 and host6 and host7 Started
INFO  BrokerService                  - ActiveMQ JMS Message Broker (broker1,
ID:
localhost-3643-1212949248389-0:0) started
INFO  DemandForwardingBridge         - Network connection between
vm://broker1#0
 and tcp://localhost:61617(broker2) has been established.
INFO  DemandForwardingBridge         - Network connection between
vm://broker1#4
 and tcp://localhost:61619(broker4) has been established.
INFO  DemandForwardingBridge         - Network connection between
vm://broker1#2
 and tcp://localhost:61618(Unknown) has been established.

So it appears connections seem good, but....if I kill broker1, my java
client reports The session is closed.  Below is my config file, anything I
am missing with this logic or implementation?

<transportConnector name="default"
uri="tcp://localhost:61616?connectionTimeout=0" />

 <networkConnector name="host1 and host2"
uri="static://(tcp://localhost:61617,tcp://localhost:61618"
failover="true"/>


Any help would be greatly appreciated, I am trying to run a test where I
close broker1, and broker 2 will maintain the connection to the client.  I
would also like to understand how to randomly connect to 1 or the other from
my client?  Do I do this in client code or is there a way to configure it in
ActiveMQ?
-- 
View this message in context: 
http://www.nabble.com/Networking-help%2C-not-working-for-me....-tp17721624s2354p17721624.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to