Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring集成延迟器-Jdbc消息存储:消息未被删除_Spring_Spring Integration - Fatal编程技术网

Spring集成延迟器-Jdbc消息存储:消息未被删除

Spring集成延迟器-Jdbc消息存储:消息未被删除,spring,spring-integration,Spring,Spring Integration,下面是我在应用程序中使用的延迟器代码。输出通道checkMessageInProgress是一个数据库存储过程调用,它将检查消息是否需要处理或延迟。 如果消息需要再次延迟,则重试计数将增加。延迟3次后,将引发自定义应用程序异常。我正在为延迟器消息使用jdbc消息存储。在消息延迟3次并引发异常的情况下,不会从数据库表中删除消息,服务器会在重新启动时拾取这些消息。如果延迟发生3次,如何确保从表中删除消息 <int:chain input-channel="delayerChannel"

下面是我在应用程序中使用的延迟器代码。输出通道checkMessageInProgress是一个数据库存储过程调用,它将检查消息是否需要处理或延迟。 如果消息需要再次延迟,则重试计数将增加。延迟3次后,将引发自定义应用程序异常。我正在为延迟器消息使用jdbc消息存储。在消息延迟3次并引发异常的情况下,不会从数据库表中删除消息,服务器会在重新启动时拾取这些消息。如果延迟发生3次,如何确保从表中删除消息

<int:chain input-channel="delayerChannel"
    output-channel="checkMessageInProgress">
    <int:header-enricher>
    <!-- Exception/ERROR handling for flows originating from Delayer -->
        <int:header name="errorChannel" value="exceptionChannel"
            overwrite="true" />
        <int:header name="retryCount" overwrite="true" type="int"
            expression="headers['retryCount'] == null ? 0 : headers['retryCount'] + 1" />
    </int:header-enricher>
    <!-- If retryCount maxed out -discard message and log it in error table -->
    <int:filter expression="(headers['retryCount'] lt 3)"
        discard-channel="raiseExceptionChannel">
    </int:filter>
    <!-- Configurable delay - fetch from property file -->
    <int:delayer id="Delayer" default-delay="${timeout}"
        message-store="mymessageStore">
        <!-- Transaction management for flows originating from the Delayer -->
        <int:transactional transactionmanager="myAppTransactionManager"/>
    </int:delayer>
</int:chain>

这并不奇怪。由于您使用事务资源(数据库),任何异常下游都会导致事务回滚,因此不会删除数据

在引发异常之前,请考虑将shift消息转移到单独的线程。这样,事务将被提交