简体   繁体   English

当TIBCO EMS服务器尝试故障转移时,客户端应该做什么?

[英]What should the client do while the TIBCO EMS server attempts failover?

The TIBCO EMS user's guide (pg 292) says: TIBCO EMS用户指南(第292页)说:

The backup server will work indefinitely to either A) become the primary server or B) reconnect to the primary server. 备份服务器将无限期地工作到A)成为主服务器或B)重新连接到主服务器。 It also says clients may receive fail-over notification when the switch is successful (see also TIBCO EMS .NET reference pg 220). 它还表示当交换机成功时, 客户端可能会收到故障转移通知 (另请参阅TIBCO EMS .NET参考第220页)。

I have some questions spinning off of these facts... 我有一些问题摆脱了这些事实......

  1. What kind of errors occur on the client side while the servers are attempting fail-over/reconnect? 当服务器尝试故障转移/重新连接时,客户端会发生什么样的错误?

  2. What is the appropriate response from the client? 客户的适当回应是什么?

    • Get new Connection objects from the ConnectionFactory until one works? 从ConnectionFactory获取新的Connection对象,直到有效吗?
    • Wait for fail-over notification? 等待故障转移通知? (are current Connection instances fixed at this time? or do I need to get a new instance?) (此时是否修复了当前的Connection实例?还是需要获取新实例?)

I hope the scenario is clear, any related information or advice would be appreciated too. 我希望这个场景很清楚,任何相关的信息或建议也会受到赞赏。

I can at least answer #1 above. 我至少可以回答上面的#1。

If you have enabled Tibems.SetExceptionOnFTSwitch(true); 如果你已经启用了Tibems.SetExceptionOnFTSwitch(true); and have set up an exception handler to capture the messages the server sends to the client, you will see the following: 并设置了一个异常处理程序来捕获服务器发送给客户端的消息,您将看到以下内容:

For single-server, non-fault tolerant connection failures: "Connection has been terminated". 对于单服务器,非容错连接故障:“连接已终止”。

For fault-tolerant connection failures: "Connection has performed fault-tolerant switch to " 对于容错连接故障:“连接已执行容错切换到”

If you attempt to publish while the connection is down, a TIBCO.EMS.IllegalStateException is thrown with the "Producer is closed" message. 如果在连接断开时尝试发布,则会抛出“生产者已关闭”消息的TIBCO.EMS.IllegalStateException。

for #2 above, I think the answer is to allow the EMS library to handle as much as possible. 对于上面的#2,我认为答案是允许EMS库尽可能地处理。 Once we got the EMS reconnect functionality to work, it gracefully tried to reconnect until the server became available again and once it reconnected, it was like there was never a problem. 一旦我们让EMS重新连接功能正常工作,它就会优雅地重新连接,直到服务器再次可用,一旦重新连接,就好像从来没有问题。 The only gotcha is probably if you try to publish a message before the ems connection is back. 唯一的问题可能是如果您尝试在ems连接恢复之前发布消息。 This is where the exception handler comes in, Once notified that you are in failover mode, you can adjust exception handling on the publisher side to suppress the error until the connection is back. 这是异常处理程序的来源。一旦通知您处于故障转移模式,您可以调整发布方的异常处理以抑制错误,直到连接恢复。 The thing I don't know is how do you tell when you've exhausted all reconnect attempts. 我不知道的是,当你耗尽所有重新连接尝试时,你怎么知道。

Anyway, Seems like our two worlds are closely related when it comes to EMS - hope our findings (based on your comments on my questions) help you. 无论如何,似乎我们的两个世界在EMS方面密切相关 - 希望我们的发现(根据您对我的问题的评论)对您有所帮助。

We use TEMS (Tibco EMS - a Tibco Product for WCF) So it becomes a custom binding. 我们使用TEMS(Tibco EMS - 用于WCF的Tibco产品)因此它成为自定义绑定。 We tried to break it by doing things like bounce the server to force switch overs and it works really well. 我们试图通过反弹服务器以强制切换来破坏它,并且它运行得非常好。 make sure you are using version 1.2 not 1.1 because you cannot do anything other then client acknowledgement. 确保您使用的是1.2版而不是1.1版,因为除了客户端确认之外,您无法执行任何操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM