简体   繁体   English

如果订户失败,则TIBCO EMS通知发布者

[英]TIBCO EMS notification to Publisher in case of Subscriber failure

I am trying to find an answer on of how to notify an EMS Publisher in case of a Subscriber failure. 我正在尝试找到有关在订户失败的情况下如何通知EMS发布者的答案。 In a case of Publisher->EMS server->Subscriber, if a Subscriber fails, I need to inform Publisher to take a corrective action.I am not bothered about durabilty/PERSIETENCE, my significance is of time. 在Publisher-> EMS服务器-> Subscriber的情况下,如果Subscriber失败,我需要通知Publisher采取纠正措施。我对烦恼/ PERSIETENCE不感到困扰,我的意思是时间。 In Trading systems, If I send an market order to a Subscriber who in turn sends it to an exchange, if it fails, I need to make my Publisher publish the messages on a different topic to another Sunscriber(another exchange). 在交易系统中,如果我将市场订单发送给订阅者,后者又将其发送到交易所,如果失败,则需要使发布者将有关其他主题的消息发布到另一个Sunscriber(另一个交易所)。 Any ideas is appreciated. 任何想法表示赞赏。

The tibjmsadmin.jar library contains methods to detect when subscribers disconnect. tibjmsadmin.jar库包含用于检测订户何时断开连接的方法。 Easier than writing code, you can: 比编写代码更容易,您可以:

  • if you have Hawk, use the tibjmsadmin.hma to write a Hawk rule in the event a subscriber disconnects, or 如果您拥有Hawk,请在订阅者断开连接时使用tibjmsadmin.hma编写Hawk规则,或者
  • listen on the monitor topic $sys.monitor.connection.disconnect - the body of the message tells you which subscriber disconnected. 在监视主题$ sys.monitor.connection.disconnect上侦听-消息正文告诉您哪个订户已断开连接。

However these "monitoring" approaches to failing over the publisher have a significant problem - in the time it takes for you to detect the subscriber failure and redirect the publisher, some messages may get through and get stuck in the defunct queue. 但是,这些用于故障转移发布者的“监视”方法存在一个严重的问题-在您检测到订阅者故障并重定向发布者所需的时间中,某些消息可能会通过并卡在已失效的队列中。 You don't wat this happening to any $10M trades! 您不会轻易在任何1000万美元的交易中发生这种情况!

EMS knows when subscribers are connected or not and you should take advantage of this. EMS知道订户何时连接,您应该利用此优势。

Use a "distributed queue" and there shouldn't be any need to code logic into your application to switch to a new subscriber when it fails. 使用“分布式队列”,并且不需要在应用程序中编写逻辑代码以在新订户失败时切换到新订户。 This happens without message loss and maintains the order of messages. 这不会丢失消息,并且可以保持消息顺序。 It is also good architectural practice to keep load balancing and failover logic out of your code and in the administration setup of your JMS provider. 将负载平衡和故障转移逻辑保持在代码之外以及JMS提供程序的管理设置中也是一种好的体系结构实践。

Basically you setup multiple subscribers to a queue (each exchange represented by a subscriber). 基本上,您将多个订户设置到一个队列(每个交换由一个订户代表)。 The default action will be for EMS to load-balance messages across your subscribers in a round-robin fashion. EMS的默认操作是以循环方式在整个订户中平衡消息的负载。 But you can set the queue to "exclusive" so that messages go to only one subscriber at a time. 但是您可以将队列设置为“独占”,以便消息一次只能发送给一个订阅者。 Then if that active subscriber fails, the messages are forwarded to another subscriber. 然后,如果该活动订户失败,则消息将转发到另一个订户。

See the EMS manual for more details on all these topics. 有关所有这些主题的更多详细信息,请参见EMS手册。

Not sure if you have access, you could try looking at the ReceiverCount or ConsumerCount in either QueueInfo or TopicInfo - I believe you need the tibjms.admin package. 不确定是否有访问权限,可以尝试查看QueueInfo或TopicInfo中的ReceiverCount或ConsumerCount-我认为您需要tibjms.admin程序包。 May be you can query this before you publish and then selectively publish? 也许您可以在发布之前查询此内容,然后有选择地发布? Not sure what the overhead is. 不知道开销是多少。

Because of the nature of JMS, AFAIK no transaction states (unless you use a XA transaction - with all of that overhead) or acknowledgements will propagate through the EMS broker. 由于JMS的性质,AFAIK没有事务状态(除非您使用XA事务-承担所有这些开销)或确认将通过EMS代理传播。 Ieacks are always between publisher and broker and consumer and broker. 想法总是在发布者和经纪人与消费者和经纪人之间。

Failing the above, you could try a separate ack topic for which the roles are reversed, but then the failure case is a timeout - I'm not sure this is sensible. 如果上述操作失败,则可以尝试使用一个单独的ack主题,将其角色互换,但是失败的案例就是超时-我不确定这是明智的。

If you don't really care which exchange the order goes to - why not make the topic/queue exclusive and make both consumers attempt to consume - the first one to succeed will process all of the messages - if it dies, then the second one (which could be periodically retrying - may successfully connect).. Alternatively allow both to process orders off the queue - remember a message will only be ever processed by a single consumer... 如果您不太在意交换的顺序-为什么不将主题/队列设为互斥并让两个使用者都尝试使用-第一个成功的消息将处理所有消息-如果消息消失,则第二个消息(这可能会定期重试-可能会成功连接。)。或者允许双方都处理队列中的订单-记住一条消息只会由单个使用者处理...

I really cannot see the advantage of a decoupled messaging bus in your order flow... makes no sense to me.. 我真的看不到订单流中的消息传递总线分离的优势...对我来说毫无意义。

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

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