Now, I have a JDBC master/slave cluster: tcp://remote1:61616,
tcp://remote2:61616, tcp:/remote3:61616
I start a VM , application write message to VM, then VM forward messages to
this master/slave cluster.
core code is below:
ActiveMQConnectionFactory factory = new
ActiveMQConnectionFactory("vm:(broker:(network:static:(tcp://remote1:61616,tcp://remote2:61616,tcp://remote3:61616))?persistent=false)");
Connection connection = factory.createConnection();
Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
connection.start();
Queue queue = session.createQueue("test");
MessageProducer producer = session.createProducer(queue);
// send messages
for (int i = 0; i < 1000000000; i++) {
producer.send(session.createTextMessage(i + "
message"));
System.out.println("Sent message " + i);
Thread.sleep(1000);
}
producer.close();
session.close();
connection.close();
But , there is a exception like this;
Exception in thread "main" javax.jms.JMSException: Peer (vm://localhost#7)
disposed.
at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:62)
at
org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1409)
at
org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1319)
at org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1798)
at
org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:289)
at
org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:224)
at
org.apache.activemq.ActiveMQMessageProducerSupport.send(ActiveMQMessageProducerSupport.java:241)
at com.test.EmbeddedProducer.main(EmbeddedProducer.java:25)
Caused by: org.apache.activemq.transport.TransportDisposedIOException: Peer
(vm://localhost#7) disposed.
at
org.apache.activemq.transport.vm.VMTransport.oneway(VMTransport.java:89)
at
org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:68)
at
org.apache.activemq.transport.ResponseCorrelator.asyncRequest(ResponseCorrelator.java:81)
at
org.apache.activemq.transport.ResponseCorrelator.request(ResponseCorrelator.java:86)
at
org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1380)
... 6 more
why throw this exception, is there some thing wrong in code ?
what is difference between
ActiveMQConnectionFactory factory = new
ActiveMQConnectionFactory("vm:(broker:(network:static:(tcp://remote1:61616,tcp://remote2:61616,tcp://remote3:61616))?persistent=false)");
and
ActiveMQConnectionFactory factory = new
ActiveMQConnectionFactory("vm:(broker:(network:masterslave:(tcp://remote1:61616,tcp://remote2:61616,tcp://remote3:61616))?persistent=false)");
another question:
if I use network:static(uri1,uri2, ...,uriN)
should a message forward to all these uris?
or forward to only one url ?
--
View this message in context:
http://activemq.2283324.n4.nabble.com/question-about-static-network-connector-tp4674057.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.