2014-07-07 5 views
0

저는 Spring Integration 3.0.1을 사용하고 있습니다. 잠시 후 jdbc 폴러가 메시지를받지 않게되었습니다. 연결이 더 이상 어떤 이유로 반환되지 않는 시점이 나타납니다. 이 문제가 발생하면 jdbc 메시지 저장소 쿼리에서 돌아 오는 SQL 형식의 알 수없는 메시지가 나타납니다.
: 첨부 는스프링 통합 : jdbc 연결이 반환되지 않았습니다.

2014-07-07 12:35:55,561 [pool-5-thread-1] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource 
2014-07-07 12:35:55,561 [pool-5-thread-1] DEBUG org.springframework.integration.jdbc.JdbcMessageStore - Marking messages with group key=8bdcf55e-a76a-392a-82f6-c7a956fcc572 
2014-07-07 12:35:55,577 [task-scheduler-6] DEBUG org.springframework.jdbc.core.JdbcTemplate - SQL update affected 1 rows 
2014-07-07 12:35:55,577 [task-scheduler-6] DEBUG org.springframework.jdbc.core.JdbcTemplate - Executing prepared SQL update 
2014-07-07 12:35:55,577 [task-scheduler-6] DEBUG org.springframework.jdbc.core.JdbcTemplate - Executing prepared SQL statement [UPDATE INT_MESSAGE_GROUP set UPDATED_DATE=? where GROUP_KEY=? and REGION=?] 
2014-07-07 12:35:55,577 [task-scheduler-6] DEBUG org.springframework.integration.jdbc.JdbcMessageStore - Updating MessageGroup: 2051f38d-526b-3092-a156-c3d72a975f7a 
2014-07-07 12:35:55,577 [task-scheduler-10] DEBUG org.springframework.jdbc.core.JdbcTemplate - SQL update affected 1 rows 
2014-07-07 12:35:55,577 [task-scheduler-10] DEBUG org.springframework.jdbc.core.JdbcTemplate - Executing prepared SQL update 
2014-07-07 12:35:55,577 [task-scheduler-10] DEBUG org.springframework.jdbc.core.JdbcTemplate - Executing prepared SQL statement [INSERT into INT_GROUP_TO_MESSAGE(GROUP_KEY, MESSAGE_ID, REGION) values (?, ?, ?)] 
2014-07-07 12:35:55,577 [task-scheduler-10] DEBUG org.springframework.integration.jdbc.JdbcMessageStore - Inserting message with id key=2e18bceb-db1b-c69b-cf59-eeffc211f597 and created date=2014-07-07 12:35:50.986 
2014-07-07 12:35:55,592 [pool-5-thread-1] DEBUG org.springframework.jdbc.core.JdbcTemplate - SQL update affected 1 rows 
2014-07-07 12:35:55,592 [pool-5-thread-1] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource 
2014-07-07 12:35:55,592 [pool-5-thread-1] DEBUG org.springframework.jdbc.core.JdbcTemplate - Executing prepared SQL query 
2014-07-07 12:35:55,592 [pool-5-thread-1] DEBUG org.springframework.jdbc.core.JdbcTemplate - Executing prepared SQL statement [SELECT MESSAGE_ID, MESSAGE_BYTES, CREATED_DATE from INT_MESSAGE where MESSAGE_ID in (SELECT MESSAGE_ID from INT_GROUP_TO_MESSAGE where GROUP_KEY = ?) and REGION=? ORDER BY CREATED_DATE] 
2014-07-07 12:35:55,592 [pool-5-thread-1] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource 
2014-07-07 12:35:55,592 [pool-5-thread-1] TRACE org.springframework.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 1, parameter value [ac032a8d-08c6-362e-a874-453e6431c3ea], value class [java.lang.String], SQL type unknown 
2014-07-07 12:35:55,592 [pool-5-thread-1] TRACE org.springframework.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 2, parameter value [DEFAULT], value class [java.lang.String], SQL type unknown 
2014-07-07 12:35:55,608 [task-scheduler-6] DEBUG org.springframework.jdbc.core.JdbcTemplate - SQL update affected 1 rows 
2014-07-07 12:35:55,608 [task-scheduler-6] DEBUG org.springframework.jdbc.core.JdbcTemplate - Executing prepared SQL query 
2014-07-07 12:35:55,608 [task-scheduler-6] DEBUG org.springframework.jdbc.core.JdbcTemplate - Executing prepared SQL statement [SELECT MESSAGE_ID, MESSAGE_BYTES, CREATED_DATE from INT_MESSAGE where MESSAGE_ID in (SELECT MESSAGE_ID from INT_GROUP_TO_MESSAGE where GROUP_KEY = ?) and REGION=? ORDER BY CREATED_DATE] 
2014-07-07 12:35:55,608 [task-scheduler-6] TRACE org.springframework.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 1, parameter value [2051f38d-526b-3092-a156-c3d72a975f7a], value class [java.lang.String], SQL type unknown 
2014-07-07 12:35:55,608 [task-scheduler-6] TRACE org.springframework.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 2, parameter value [DEFAULT], value class [java.lang.String], SQL type unknown 

샘플 구성 ... 로그 추출물 느릅 나무는 이후 'SQL 유형 알 수없는'로이 후에 및 계속 메시지를 가져 오기 한 후 가져 오기/반품 보여주고있다

<int-jdbc:inbound-channel-adapter id="JDBCInboundChannel" query="select * from CACHE_REPOSITORY where status='X' AND CREATION_TIME + INTERVAL '15' SECOND &lt; SYSDATE order by CREATION_TIME" 
    channel="splitterInChannel" data-source="dataSource" update="update CACHE_REPOSITORY set STATUS='Y' WHERE GUID IN (:guid)" row-mapper="rowMapper" 
    max-rows-per-poll="10" > 
    <int:poller id="jdbcPoller" fixed-delay="1000" receive-timeout="5000" > 
     <int:transactional transaction-manager="cacheTransactionManager"/> 
    </int:poller> 
</int-jdbc:inbound-channel-adapter> 

<int:channel id="splitterInChannel" /> 
<int:splitter id="splitter" input-channel="splitterInChannel" output-channel="aggregatorInChannel" /> 

<!-- Beans to support Aggregation -->  
<bean id="aggregatorBean" class="org.abc.integration.QueueItemAggregator" /> 
<bean id="reportTypeCorrelationStrategry" class="org.abc.integration.ReportTypeCorrelationStrategy" /> 
<bean id="releaseStrategry" class="org.abc.integration.ReportTypeReleaseStrategy"/> 

<int:aggregator id="reportTypeAggregator" input-channel="aggregatorInChannel" 
    output-channel="archiveCreationChannel" 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" discard-channel="errorChannel" /> 

<int:channel id="archiveCreationChannel" > 
    <int:queue message-store="jdbc-messageStore" /> 
</int:channel>    

<!-- Endpoint responsible for creating Archive from List of Document objects --> 
<bean id="cacheArchiveCreator" class="org.abc.integration.CacheArchiveCreator"/> 

<int:service-activator ref="cacheArchiveCreator" method="createArchive" input-channel="archiveCreationChannel" > 
    <int:poller max-messages-per-poll="1" fixed-rate="1000" error-channel="errorChannel" > 
     <int:transactional transaction-manager="cacheTransactionManager"/> 
    </int:poller> 
</int:service-activator> 
+0

정말로 어디에 문제가 있는지 명확하지 않습니다. StackTrace를 제공 ​​할 수 있습니까? "폴러는 메시지를받지 못합니다."- 메시지가 Store에 없기 때문일 수 있습니다. –

+0

그건 문제의 큰 부분입니다. 스택 트레이스가 없습니다. org.spring.integration에 대한 TRACE가 있습니다. 설문 조사를 위해 데이터베이스에 100 개의 행을 테스트하고, 얼마나 많은 점수를 받았는지 추적합니다. 응용 프로그램을 시작할 때 해당 응용 프로그램은 레코드 폴링을 시작합니다. 폴러가 폴링을 중지하는 시점에 따라 100 개가 모두 수집되는지 여부에 따라 달라집니다. jdbc 메시지 저장소 (Aggregator, 채널 및 메시지 저장소 리퍼)를 사용하는 여러 구성 요소가 있습니다. 폴링이 중단되면 끝점에서 추가 메시지가 표시되지 않습니다. – user3802300

+0

그래서 100 개의 모든 레코드를 폴링 할 수 있지만 엔드 포인트에서 46 개만 가져 오거나 40 개의 메시지를 폴링하여 엔드 포인트에서 더 적게 얻을 수 있습니다. – user3802300

답변

0

은 응용 프로그램에 문제가있다. 또는 reaper은 모든 경고 메시지를 제거하거나 모든 메시지를 읽기 전에 폴러를 중지합니다. 당신은이 문제에 대해 불평하는 첫 번째 사람입니다.

어 그리 게이터 + 리퍼 및 채널에 대해 다른 메시지 저장소를 구성하십시오 (http://docs.spring.io/spring-integration/docs/latest-ga/reference/html/jdbc.html#jdbc-message-store).

내가 말한대로 구성을 살펴보면 수집기와 채널에 다른 MessageStore 콩을 사용하십시오. 채널에 JdbcChannelMessageStore을 사용한다면 더 좋을 것입니다.

+0

감사합니다. Artem, 저도 시도해 보겠습니다. Xml 구성을 통해 사용할 수있는 기본 implment가 있습니까? 아니면 자체 bean을 만들어야합니까? 예를 찾을 수 없습니다. 그렇게해야하는 경우 쿼리 공급자를 제공해야합니까? – user3802300

+0

당신은 일반적인 ''정의와 오른쪽으로 설정해야합니다 : 특정 DB에는'queryProvider'가 필요합니다. –

+0

여기에 내가있는 곳이있다. 제안 된대로 JdbcChannelMessageStore를 추가하고 내 채널에이를 사용했습니다. jdbc 메시지 저장소와 동일한 데이터 소스를가집니다. 애그리 게이터/리퍼가 모두 jdbc 메시지 저장소를 사용하고 채널이 채널 특정 메시지 저장소를 사용하면 폴링이 약 절반 정도 종료됩니다. in 중 하나를 위해 메모리 저장소를 사용하면 모든 것이 잘 작동합니다. DB 연결이 끊어 질 수 있습니까? – user3802300

관련 문제