与jms的事务:入站通道适配器

时间:2015-05-19 13:13:12

标签: spring-integration

我想用jms:inbound-channel-adapter来读取jms消息并应用处理,如果处理抛出异常,我希望该代理保持消息

<int-jms:inbound-channel-adapter 
        id="jmsAdapter"
        session-transacted="true"
        destination="destination"
        connection-factory="cachedConnectionFactory"
        channel="inboundChannel"
        auto-startup="false">
    <int:poller fixed-delay="100"></int:poller>
</int-jms:inbound-channel-adapter>

我查看了jmsTemplate.doReceive的代码

Message message = doReceive(consumer, timeout);
        if (session.getTransacted()) {
            // Commit necessary - but avoid commit call within a JTA transaction.
            if (isSessionLocallyTransacted(session)) {
                // Transacted session created by this template -> commit.
                JmsUtils.commitIfNecessary(session);
            }
        }
        else if (isClientAcknowledge(session)) {
            // Manually acknowledge message, if any.
            if (message != null) {
                message.acknowledge();
            }
        }

我们在直接阅读后承认

我该怎么办?

0 个答案:

没有答案