简体   繁体   English

解决Tibco EMS和.NET API中的预取

[英]Working around pre-fetch in Tibco EMS and .NET API

All in context of Tibco EMS 5.* and .NET API 全部在Tibco EMS 5. *和.NET API的上下文中

I've to work along existing model of message processing, in which in a loop: 我必须处理现有的消息处理模型,该模型处于一个循环中:

  • connection is created / open 连接已创建/打开
  • session is created / open 会话已创建/打开
  • message consumer is created 消息使用者已创建
  • receive method is called 接收方法称为

if message != null then we consume it and either commit or rollback the transaction (on underlying session). 如果消息!= null,那么我们将使用它并提交或回滚事务(在基础会话上)。 System pulls every x sec in that model. 系统在该模型中每隔x秒拉一次。

I've created a connection factory that assures that only new sessions are created (if the previous session is still in use). 我创建了一个连接工厂,以确保仅创建新会话(如果以前的会话仍在使用中)。 In that way system works on the same connection. 这样系统可以在同一连接上工作。

However, I've run into issue with pre-fetch as each Receive call (by .NET interface) returns one message and puts several (pre-fetch-1) to local queue. 但是,由于每个Receive调用(通过.NET接口)返回一条消息并将几条(pre-fetch-1)放入本地队列,因此在预取方面遇到了问题。 So I should reuse the same session next time really in order to read messages that are already pulled. 因此,下一次我应该真正重用同一会话,以读取已提取的消息。 I've put in wrappers to reuse the session & message consumer as long as there is something there (Receive won't return null). 只要有东西(接收不会返回空值),我就使用包装器来重用会话和消息使用者。 This approach kind of works, but it seems that I might have get null on Receive, even though there is still something fetched locally. 这种方法是可行的,但即使在本地仍然获取某些内容,我似乎也无法在Receive上获取null。 It also seems that as long as I'm on the same connection fetched messages will be marked as delivered (even if session is explicitly closed). 似乎只要我在同一连接上,提取的消息就会被标记为已送达(即使会话已显式关闭)。

Would someone have any idea how to either open connection / session with pre-fetch = 1? 有人会知道如何使用预取= 1打开连接/会话吗? Or there is better solution? 还是有更好的解决方案?

Thanks in advance, 提前致谢,

解决方法:在队列级别关闭预取。

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

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