使用activemq故障转移URI进行重新连接,而第一次连接超时 [英] using activemq failover URI for reconnecting, while timeout on first connection

查看:343
本文介绍了使用activemq故障转移URI进行重新连接,而第一次连接超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用activemq故障转移工具来使客户端重新连接到代理,而且我也没有 希望在断开连接时阻止发送"操作,所以我使用的是URI,如failover:(tcp://192.168.193.177:61616)?timeout=1,而问题是如果我第一次无法连接,连接将超时并且重新连接不起作用,我得到的例外情况:

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:

2011年12月7日下午3:39:28 org.apache.activemq.transport.failover.FailoverTransport单向传输 INFO:故障转移在2毫秒后超时 2011年12月7日,下午3:39:28 org.apache.activemq.transport.failover.FailoverTransport doReconnect 信息:成功连接到tcp://127.0.0.1:61616 线程"pool-1-thread-2"中的异常java.lang.NullPointerException 在com.cicc.mdf.dataserver.messaging.JMSMessagePublisher.publish(JMSMessagePublisher.java:197) 在com.cicc.mdf.dataserver.messaging.JMSMessagePublisher.publishRealTimeData(JMSMessagePublisher.java:270) 在com.cicc.mdf.dataserver.service.MarketDataService.process(MarketDataService.java:984) 在com.cicc.mdf.message.parser.BroadcastMessageParser.parseElement(BroadcastMessageParser.java:219) 在com.cicc.mdf.connectivity.RawDataParser.slice(RawDataParser.java:433) 在com.cicc.mdf.connectivity.RawDataParser.run(RawDataParser.java:110) 在java.util.concurrent.ThreadPoolExecutor $ Worker.runTask(ThreadPoolExecutor.java:886) 在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:908)

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)

我认为timeout参数仅适用于发送操作,而不会影响重新连接,但是第一次连接是什么?

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

如果Java客户端第一次成功连接到代理,则连接断开,如果未建立连接,发送操作将超时,而Java客户端将重新连接到代理,即我预期的. 如果Java客户端第一次无法成功连接到代理,则连接将超时,直到成功之前我都不会尝试重新连接,这是我错了吗?

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?

Activemq版本:5.3.0

Activemq version: 5.3.0

对不起,URI有效,这是我的错误,我被另一个异常所迷惑

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

有什么主意吗?

谢谢

ps:这是我第一次使用Stackoverflow,代表任何非常规的行为,请纠正

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

推荐答案

您的URI似乎有效.您能否解释一下重新连接不起作用"是什么意思?可能是指数回退增加了太多,您以为它不会重新连接?

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

请附上您客户的一些日志,我们可能会获得有关重新连接为何无效的更多信息. 您正在使用什么ActiveMQ客户端? Java的? C ++? C#?

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#?

这篇关于使用activemq故障转移URI进行重新连接,而第一次连接超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆