Websphere Liberty概要文件-事务化Websphere MQ连接工厂

Websphere Liberty概要文件-事务化Websphere MQ连接工厂,websphere,apache-camel,ibm-mq,websphere-liberty,Websphere,Apache Camel,Ibm Mq,Websphere Liberty,试图让我的Liberty概要文件服务器创建到我的Websphere消息队列实例的事务处理jmsConnectionFactory Liberty profile v 8.5.5.5 WebSphereMQ7.x 我尝试将jmsQueueConnectionFactory更改为jmsQueueConnectionFactory,但没有帮助->然后它似乎只是忽略了它,没有连接到MQ server.xml <?xml version="1.0" encoding="UTF-8"?> &l

试图让我的Liberty概要文件服务器创建到我的Websphere消息队列实例的事务处理jmsConnectionFactory

Liberty profile v 8.5.5.5
WebSphereMQ7.x

我尝试将jmsQueueConnectionFactory更改为jmsQueueConnectionFactory,但没有帮助->然后它似乎只是忽略了它,没有连接到MQ

server.xml

<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">

  <!-- Enable features -->
  <featureManager>
    <feature>wmqJmsClient-1.1</feature>
    <feature>jndi-1.0</feature>
    <feature>jsp-2.2</feature>
    <feature>localConnector-1.0</feature>
  </featureManager>

  <variable name="wmqJmsClient.rar.location" value="D:\wlp\wmq\wmq.jmsra.rar"/>

  <jmsQueueConnectionFactory jndiName="jms/wmqCF" connectionManagerRef="ConMgr6">
    <properties.wmqJms
            transportType="CLIENT"
            hostName="hostname"
            port="1514"
            channel="SYSTEM.DEF.SVRCONN"
            queueManager="QM"           
            />
  </jmsQueueConnectionFactory>

  <connectionManager id="ConMgr6" maxPoolSize="2"/>

  <applicationMonitor updateTrigger="mbean"/>
  <application id="App"
               location="...\app.war"
               name="App" type="war"/>
  <!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
  <httpEndpoint id="defaultHttpEndpoint"
                httpPort="9080"
                httpsPort="9443"/>
</server>
驼峰代码

public static JmsComponent mqXAComponentTransacted(InitialContext context, String jndiName) throws JMSException, NamingException {
    return JmsComponent.jmsComponentTransacted((XAQueueConnectionFactory) context.lookup(jndiName));
}
结果是:

public static JmsComponent mqXAComponentTransacted(InitialContext context, String connectionFactoryJndiName, String userTransactionJndiName) throws JMSException, NamingException {
    LOG.info("Setting up JmsComponent using jndi lookup");
    final JtaTransactionManager jtaTransactionManager = new JtaTransactionManager((UserTransaction) context.lookup(userTransactionJndiName));
    final ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup(connectionFactoryJndiName);
    final JmsComponent jmsComponent = JmsComponent.jmsComponentTransacted(connectionFactory, (PlatformTransactionManager) jtaTransactionManager);
    jmsComponent.setTransacted(false);
    jmsComponent.setCacheLevel(DefaultMessageListenerContainer.CACHE_NONE);
    return jmsComponent;
}

Camel是否需要一个完整的XA连接工厂?它将是xa协调器还是只使用jms事务会话?在我没有使用JNDI查找并使用JmsComponent.JMSComponentTransact(connectionFactoryAdapter)之前,connectionFactoryAdapter用于设置凭据,它使用MQXAQueueConnectionFactory。这确实有效,它在准备好处理消息时提交给生产者,但现在不行。我需要的是,Camel在处理消息后进行提交,这样在处理消息时队列管理器停机或应用程序停机时不会丢失。使用JmsComponent.JmsComponent()只会使用队列中的消息,消息可能会丢失
public static JmsComponent mqXAComponentTransacted(InitialContext context, String connectionFactoryJndiName, String userTransactionJndiName) throws JMSException, NamingException {
    LOG.info("Setting up JmsComponent using jndi lookup");
    final JtaTransactionManager jtaTransactionManager = new JtaTransactionManager((UserTransaction) context.lookup(userTransactionJndiName));
    final ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup(connectionFactoryJndiName);
    final JmsComponent jmsComponent = JmsComponent.jmsComponentTransacted(connectionFactory, (PlatformTransactionManager) jtaTransactionManager);
    jmsComponent.setTransacted(false);
    jmsComponent.setCacheLevel(DefaultMessageListenerContainer.CACHE_NONE);
    return jmsComponent;
}