Spring JMS 中的事务划分/事务边界
我在 DefaultMessageListenerContainer
(DMLC) 上实现了 3 个 Spring JMS 监听器 A、B 和 C 链。所有 DMLC 都部署在一个 Java EE 应用程序中。
A 和 C:
- 注入了一个事务管理器(同一个),
- 它们都接收和发送消息对于事务会话,
- 相同的 ConnectionFactory 被注入到它们的 DMLC(用于接收)中并用于发送。
B:
- 没有事务管理器,
- 发送无事务消息 (
Connection.createSession(false, AUTO_ACKNOWLEDGE)
), - 具有不同的非 XA ConnectionFactory
问题: 事务边界是否如下图所示,并且事务 1 和 2 是分开的(ML = 消息监听器)?
| transaction 1 | ? | no transaction | ? | transaction 2 |
(broker) --> [ML A] --> (broker) --> [ML B] --> (broker) --> [ML C] |
或者也许事务 1 和 2 是一个,并且“ML B”是非事务性的这一事实对连续性没有影响?
附加问题:当消息位于代理中时,标记为“?”的位置中的活动事务会发生什么情况?
我不知道如何访问事务管理器日志,所以我无法真正验证这一点。
I have a chain of 3 Spring JMS listeners A, B and C implemented on DefaultMessageListenerContainer
(DMLC). All DMLCs are deployed in one Java EE application.
A and C:
- have a transaction manager injected (the same one),
- they both receive and send messages in transacted sessions,
- the same ConnectionFactory is injected in their DMLC (for receiving) and used for sending.
B:
- has no transaction manager,
- sends transactionless messages (
Connection.createSession(false, AUTO_ACKNOWLEDGE)
), - has a different, non-XA ConnectionFactory
Question: are transaction borders as illustrated below, and transactions 1 and 2 are separate (ML = message listener)?
| transaction 1 | ? | no transaction | ? | transaction 2 |
(broker) --> [ML A] --> (broker) --> [ML B] --> (broker) --> [ML C] |
Or maybe transaction 1 and 2 are one, and the fact that the "ML B" is non-transactional has no effect on continuity?
Additional question: what happens to the active transaction in the places marked "?", when the message is in the broker?
I don't know how to access transaction manager logs, so I cannot really verify that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论