我可以在 WebSphere 中设置非事务性 JMS 连接工厂吗?
该工厂将基于默认消息传递提供程序。
这样做的原因是我有一个模拟 MDB 来代替外部系统,通常通过 Websphere MQ 连接。模拟和测试的应用程序安装在同一台服务器上,因此我需要确保在循环中
request -> mock listener -> mock reply -> response
request
和 reply
是两个单独的事务。
我在控制台中看不到任何将工厂从事务管理器的监督中删除的选项。
The factory will be based on Default messaging provider.
The reason for doing so is I have a mock MDB in place of an external system, normally connected via Websphere MQ. The mock and the tested application are installed on the same server, so I need to make sure that in the cycle
request -> mock listener -> mock reply -> response
request
and reply
are two separate transactions.
I can't see any option in the console to remove the factory from transaction manager's supervision.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的观察是正确的,JMS 连接工厂无法配置为不加入当前事务。我有点不确定你想在这里实现什么,但我将做出以下假设:
在这种情况下,客户端需要发送并提交监听器之前的消息将让它发送回复。侦听器可以在一个事务中接收和回复,但客户端需要两个事务。我还假设客户端是 EJB。
对此的一种解决方案是使用 bean 管理的事务。在这种情况下,您可以手动开始事务并在 1 点左右提交,并在 3 点左右再次提交。这将导致消息被发送。
另一种解决方案是在一个 EJB 方法中使用 RequiresNew 进行发送,并在另一个 EJB 方法中使用 RequiresNew 进行接收。然后,客户端调用发送 EJB 方法,然后调用接收 EJB 方法,每个方法都有自己的事务。
You are correct in your observation that the JMS Connection Factory cannot be configured to not enlist in the current transaction. I am a little unsure of what you are trying to achive here, but I'm going to make the following assumption:
In this scenario the client needs to send and commit the message before the listener will get it to send the reply. The listener can receive and reply in one transaction, but the client needs two. I am furthermore assuming that the client is an EJB.
One solution to this would be use bean managed transactions. In this case you can manually begin a transaction and commit it around 1 and again around 3. This will cause the message to be sent.
Another solution would be to do the send in an EJB method with RequiresNew and the receive in another EJB method with RequiresNew. Then the client calls the send EJB method followed by the receive EJB method and each method has its own transaction.
不能从 ejb-jar.xml 中执行此操作吗?
Can you not do this from the ejb-jar.xml?