Websphere Liberty profile - transacted Websphere MQ connection factory

巧了我就是萌 提交于 2019-12-05 11:39:34

Ended up with:

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