using activemq failover URI for reconnecting, while timeout on first connection

﹥>﹥吖頭↗ 提交于 2019-12-11 12:42:19

问题


I am currently using activemq failover uir for client reconnecting to the broker, and I also don't want "send" operation to be blocked when it disconnect, so I am using URI likefailover:(tcp://192.168.193.177:61616)?timeout=1, while the problem is if I can't get connection for the first time, the connecting will time out and the reconnecting doesn't work, the exception I got:

Dec 7, 2011 3:39:28 PM org.apache.activemq.transport.failover.FailoverTransport oneway INFO: Failover timed out after 2ms Dec 7, 2011 3:39:28 PM org.apache.activemq.transport.failover.FailoverTransport doReconnect INFO: Successfully connected to tcp://127.0.0.1:61616 Exception in thread "pool-1-thread-2" java.lang.NullPointerException at com.cicc.mdf.dataserver.messaging.JMSMessagePublisher.publish(JMSMessagePublisher.java:197) at com.cicc.mdf.dataserver.messaging.JMSMessagePublisher.publishRealTimeData(JMSMessagePublisher.java:270) at com.cicc.mdf.dataserver.service.MarketDataService.process(MarketDataService.java:984) at com.cicc.mdf.message.parser.BroadcastMessageParser.parseElement(BroadcastMessageParser.java:219) at com.cicc.mdf.connectivity.RawDataParser.slice(RawDataParser.java:433) at com.cicc.mdf.connectivity.RawDataParser.run(RawDataParser.java:110) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

I thought the timeout parameter only works on send operation without interfere with reconnecting, but the first connecting?

EDIT: if the java client connected to the broker successfully for the first time, then if connection got disconnected, send operation will time out when connection don't established, and java client will reconnect to the broker, that what i am expected. while if java client can't connect to the broker successfully for the first time, the connecting will time out, not trying to reconnect till successfully that what i am unexpected, am I some place wrong?

EDIT: Activemq version: 5.3.0

EDIT: Sorry, the URI is valid, it's my mistake, I was confused by another exception

any idea?

Thanks

ps: this is my first time on Stackoverflow, any unconventional behalve, pls correct it


回答1:


Your URI seems valid. Can you explain maybe what do you mean by "the reconnecting doesn't work"? Might it be that the exponential back off increases so much you think it doesn't reconnect?

You can disable it and try again:

failover:(tcp://localhost:61616)?useExponentialBackOff=false

Please include a bit of logs of your client, we might get more information on why the reconnecting doesn't work. What is the ActiveMQ client you are using? Java? C++? C#?



来源:https://stackoverflow.com/questions/8428131/using-activemq-failover-uri-for-reconnecting-while-timeout-on-first-connection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!