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

谁说我不能喝 提交于 2019-12-24 07:58:47

问题


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,


回答1:


Workaround: turn-off prefetching on the queue level.



来源:https://stackoverflow.com/questions/4143711/working-around-pre-fetch-in-tibco-ems-and-net-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!