gpt4 book ai didi

jms - DefaultJMSConnectionFactory 和 JmsXA 之间的区别

转载 作者:行者123 更新时间:2023-12-02 18:25:56 26 4
gpt4 key购买 nike

Wildfly 10 开箱即用地将池连接工厂配置为具有两个条目的 JMS 子系统的一部分。

      <pooled-connection-factory name="activemq-ra"
transaction="xa"
connectors="in-vm"
entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory"/>

人们可能会像这样注入(inject)连接工厂:

@Resource(mappedName = "java:jboss/DefaultJMSConnectionFactory")
private ConnectionFactory connectionFactory;

这和选择其他条目有什么区别; java:/JmsXA?

最佳答案

没有什么区别,它是一个额外的 JNDI 条目,以适应 JMS 2 规范默认 ConnectionFactory 名称:java:comp/DefaultJMSConnectionFactory

您应该使用此名称来解析它。

Since JMS 2.0, a default JMS connection factory is accessible to EE application under the JNDI name java:comp/DefaultJMSConnectionFactory. WildFly messaging subsystem defines a pooled-connection-factory that is used to provide this default connection factory. Any parameter change on this pooled-connection-factory will be take into account by any EE application looking the default JMS provider under the JNDI name java:comp/DefaultJMSConnectionFactory.

See https://docs.jboss.org/author/display/WFLY9/Messaging+configuration

另一个只是一个旧标识符:

The JCA layer intercepts the calls to createConnection() and createSession() and provides a caching layer (amongst other things). So when you call createConnection() or createSession(), then, in most cases it's not really calling the actual JMS implementation to actually create a new JMS connection or JMS session, it's just returning one from it's own internal cache - in other words the JCA layer pools JMS connections and JMS sessions.

In JBoss application server, the "special" JMS connection factory which provides the JCA caching is usually available at java:/JmsXA in jndi.

参见https://developer.jboss.org/wiki/ShouldICacheJMSConnectionsAndJMSSessions

关于jms - DefaultJMSConnectionFactory 和 JmsXA 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39962774/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com