Spring集成 - Oracle锁争用

时间:2014-07-17 13:46:32

标签: spring-integration

我们的应用程序中的jdbc入站通道适配器和消息存储一致地停止查询数据,并且我已经能够将其跟踪到阻塞的Oracle会话。在Oracle中,我们得到了enq:TX - 行锁争用。 DBA将其跟踪到以下内容:

SELECT COMPLETE, LAST_RELEASED_SEQUENCE, CREATED_DATE, UPDATED_DATE
from INT_MESSAGE_GROUP
where GROUP_KEY = :1 and REGION=:2 

非常感谢任何有关如何解决此问题的建议。

SI配置(摘录):

<int-jdbc:message-store id="jdbc-messageStore" data-source="dataSource"  /> 
<int-jdbc:inbound-channel-adapter id="JDBCInboundChannel"     query="${cache.integration.jdbc.selectQuery}" 
    channel="inboundMessagesChannel" data-source="dataSource"  update="update CACHE_REPOSITORY set STATUS='P' WHERE GUID IN (:guid)" row-mapper="rowMapper" 
    max-rows-per-poll="${cache.integration.jdbc.maxRowsPerPoll}" auto-startup="false" >
    <int:poller id="jdbcPoller" fixed-delay="${cache.integration.jdbc.fixedDelay}"   >
        <int:transactional />
    </int:poller>
</int-jdbc:inbound-channel-adapter>
<int:chain...>
<int:aggregator id="reportTypeAggregator" ref="aggregatorBean" method="collect"
         message-store="jdbc-messageStore" release-strategy="releaseStrategry"  
        release-strategy-method="canRelease" correlation-strategy="reportTypeCorrelationStrategry"
        correlation-strategy-method="correlate" send-partial-result-on-expiry="true"
        expire-groups-upon-completion="true" empty-group-min-timeout="30000" />
</int:chain>        
<bean id="queryProvider" class="org.springframework.integration.jdbc.store.channel.OracleChannelMessageStoreQueryProvider"/>     
 <bean id="jdbc-channel-messageStore" class="org.springframework.integration.jdbc.store.JdbcChannelMessageStore">
    <property name="dataSource" ref="dataSource"/>   
    <property name="channelMessageStoreQueryProvider" ref="queryProvider"/>
    <property name="region" value="${cache.integration.channelMessageStore.region}"/>

</bean>     

<int:channel id="archiveCreationChannel" >  
    <int:queue  message-store="jdbc-channel-messageStore" />
    <int:interceptors>
        <int:wire-tap channel="logger" timeout="-1"/>
    </int:interceptors>
</int:channel>

<bean id="documentMessageStoreReaper" class="org.springframework.integration.store.MessageGroupStoreReaper">
    <property name="messageGroupStore" ref="jdbc-messageStore" />
    <property name="timeout" value="${cache.integration.reaper.timeout}" />
    <property name="autoStartup" value="false" />
</bean>

<task:scheduled-tasks>
    <task:scheduled ref="documentMessageStoreReaper" method="run" fixed-rate="10000" />
</task:scheduled-tasks> 

1 个答案:

答案 0 :(得分:0)

我认为主要问题是fixed-rate documentMessageStoreReaperDELETE from INT_MESSAGE_GROUP启动fixed-dealy。您应该将其更改为DELETE from INT_MESSAGE_GROUP以避免并发任务。

由于您说{{1}}非常长,因此任务之间10秒可能还不够。