简体   繁体   中英

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

All in context of Tibco EMS 5.* and .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). System pulls every x sec in that model.

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. 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. 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? Or there is better solution?

Thanks in advance,

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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