环境:MAC OS X 10.11.5 + ActiveMQ 5.13.3
1. 客户端访问代码增加 trace=true 参数
"failover:(tcp://127.0.0.1:61619?trace=true)");
2. conf/log4j.properties 文件中增加两行如下:
log4j.rootLogger=INFO, console, logfile
log4j.logger.org.apache.activemq.spring=WARN
log4j.logger.org.apache.activemq.web.handler=WARN
log4j.logger.org.springframework=WARN
log4j.logger.org.apache.xbean=WARN
log4j.logger.org.apache.camel=INFO
log4j.logger.org.eclipse.jetty=WARN
log4j.logger.org.apache.activemq.transport.TransportLogger=DEBUG
log4j.logger.org.apache.activemq.transport.failover.FailoverTransport=DEBUG
3. Java 启动脚本里增加activemq.base 和 log4j.configuration 变量
java -Dactivemq.base=/Users/maping/Apache/activemq-cluster/activemq-node3 -Dlog4j.configuration=file:/Users/maping/Apache/activemq-cluster/activemq-node3/conf/log4j.properties -cp /Users/maping/Apache/activemq/activemq-all-5.13.3.jar:/Users/maping/NetBeansProjects/NB7/TravelskyActiveMqTest/dist/TravelskyActiveMqTest.jar com.travelsky.activemq.Queue_Sender_AutoAck_Peresistent
4. 启动 ActiveMQ,启动 Java 程序发送消息
发现 data/activemq.log 中在输出 DEBUG 信息:
2016-07-06 15:10:41,019 | DEBUG | SENDING: ActiveMQTextMessage {commandId = 26, responseRequired = true, messageId = ID:MaPingdeMacBook-Pro.local-53666-1467789029620-1:1:1:1:22, originalDestination = null, originalTransactionId = null, producerId = ID:MaPingdeMacBook-Pro.local-53666-1467789029620-1:1:1:1, destination = queue://FirstQueue, transactionId = null, expiration = 0, timestamp = 1467789041018, arrival = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false, text = ActiveMq发送的消息22} | org.apache.activemq.transport.TransportLogger.Connection:1 | main
2016-07-06 15:10:41,022 | DEBUG | RECEIVED: Response {commandId = 0, responseRequired = false, correlationId = 26} | org.apache.activemq.transport.TransportLogger.Connection:1 | ActiveMQ Transport: tcp:///127.0.0.1:61619@53667
停止 ActiveMQ,这时会发现 data/activemq.log 中继续在输出 DEBUG 信息:
每次企图重连 ActiveMQ,连接不成功的话,等待一倍的时间,再次重试:
2016-07-06 15:12:35,687 | DEBUG | Attempting 6th connect to: tcp://127.0.0.1:61619 | org.apache.activemq.transport.failover.FailoverTransport | ActiveMQ Task-2
2016-07-06 15:12:35,688 | DEBUG | Connect fail to: tcp://127.0.0.1:61619, reason: java.net.ConnectException: Connection refused | org.apache.activemq.transport.failover.FailoverTransport | ActiveMQ Task-2
2016-07-06 15:12:35,688 | DEBUG | Waiting 1280 ms before attempting connection | org.apache.activemq.transport.failover.FailoverTransport | ActiveMQ Task-2
2016-07-06 15:12:36,972 | DEBUG | urlList connectionList:[tcp://127.0.0.1:61619], from: [tcp://127.0.0.1:61619] | org.apache.activemq.transport.failover.FailoverTransport | ActiveMQ Task-2
2016-07-06 15:12:36,973 | DEBUG | Attempting 7th connect to: tcp://127.0.0.1:61619 | org.apache.activemq.transport.failover.FailoverTransport | ActiveMQ Task-2
2016-07-06 15:12:36,973 | DEBUG | Connect fail to: tcp://127.0.0.1:61619, reason: java.net.ConnectException: Connection refused | org.apache.activemq.transport.failover.FailoverTransport | ActiveMQ Task-2
2016-07-06 15:12:36,973 | DEBUG | Waiting 2560 ms before attempting connection | org.apache.activemq.transport.failover.FailoverTransport | ActiveMQ Task-2
2016-07-06 15:12:39,535 | DEBUG | urlList connectionList:[tcp://127.0.0.1:61619], from: [tcp://127.0.0.1:61619] | org.apache.activemq.transport.failover.FailoverTransport | ActiveMQ Task-2
1. 客户端访问代码增加 trace=true 参数
"failover:(tcp://127.0.0.1:61619?trace=true)");
2. conf/log4j.properties 文件中增加两行如下:
log4j.rootLogger=INFO, console, logfile
log4j.logger.org.apache.activemq.spring=WARN
log4j.logger.org.apache.activemq.web.handler=WARN
log4j.logger.org.springframework=WARN
log4j.logger.org.apache.xbean=WARN
log4j.logger.org.apache.camel=INFO
log4j.logger.org.eclipse.jetty=WARN
log4j.logger.org.apache.activemq.transport.TransportLogger=DEBUG
log4j.logger.org.apache.activemq.transport.failover.FailoverTransport=DEBUG
3. Java 启动脚本里增加activemq.base 和 log4j.configuration 变量
java -Dactivemq.base=/Users/maping/Apache/activemq-cluster/activemq-node3 -Dlog4j.configuration=file:/Users/maping/Apache/activemq-cluster/activemq-node3/conf/log4j.properties -cp /Users/maping/Apache/activemq/activemq-all-5.13.3.jar:/Users/maping/NetBeansProjects/NB7/TravelskyActiveMqTest/dist/TravelskyActiveMqTest.jar com.travelsky.activemq.Queue_Sender_AutoAck_Peresistent
4. 启动 ActiveMQ,启动 Java 程序发送消息
发现 data/activemq.log 中在输出 DEBUG 信息:
2016-07-06 15:10:41,019 | DEBUG | SENDING: ActiveMQTextMessage {commandId = 26, responseRequired = true, messageId = ID:MaPingdeMacBook-Pro.local-53666-1467789029620-1:1:1:1:22, originalDestination = null, originalTransactionId = null, producerId = ID:MaPingdeMacBook-Pro.local-53666-1467789029620-1:1:1:1, destination = queue://FirstQueue, transactionId = null, expiration = 0, timestamp = 1467789041018, arrival = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false, text = ActiveMq发送的消息22} | org.apache.activemq.transport.TransportLogger.Connection:1 | main
2016-07-06 15:10:41,022 | DEBUG | RECEIVED: Response {commandId = 0, responseRequired = false, correlationId = 26} | org.apache.activemq.transport.TransportLogger.Connection:1 | ActiveMQ Transport: tcp:///127.0.0.1:61619@53667
停止 ActiveMQ,这时会发现 data/activemq.log 中继续在输出 DEBUG 信息:
每次企图重连 ActiveMQ,连接不成功的话,等待一倍的时间,再次重试:
2016-07-06 15:12:35,687 | DEBUG | Attempting 6th connect to: tcp://127.0.0.1:61619 | org.apache.activemq.transport.failover.FailoverTransport | ActiveMQ Task-2
2016-07-06 15:12:35,688 | DEBUG | Connect fail to: tcp://127.0.0.1:61619, reason: java.net.ConnectException: Connection refused | org.apache.activemq.transport.failover.FailoverTransport | ActiveMQ Task-2
2016-07-06 15:12:35,688 | DEBUG | Waiting 1280 ms before attempting connection | org.apache.activemq.transport.failover.FailoverTransport | ActiveMQ Task-2
2016-07-06 15:12:36,972 | DEBUG | urlList connectionList:[tcp://127.0.0.1:61619], from: [tcp://127.0.0.1:61619] | org.apache.activemq.transport.failover.FailoverTransport | ActiveMQ Task-2
2016-07-06 15:12:36,973 | DEBUG | Attempting 7th connect to: tcp://127.0.0.1:61619 | org.apache.activemq.transport.failover.FailoverTransport | ActiveMQ Task-2
2016-07-06 15:12:36,973 | DEBUG | Connect fail to: tcp://127.0.0.1:61619, reason: java.net.ConnectException: Connection refused | org.apache.activemq.transport.failover.FailoverTransport | ActiveMQ Task-2
2016-07-06 15:12:36,973 | DEBUG | Waiting 2560 ms before attempting connection | org.apache.activemq.transport.failover.FailoverTransport | ActiveMQ Task-2
2016-07-06 15:12:39,535 | DEBUG | urlList connectionList:[tcp://127.0.0.1:61619], from: [tcp://127.0.0.1:61619] | org.apache.activemq.transport.failover.FailoverTransport | ActiveMQ Task-2
没有评论:
发表评论