아래 봄 통합 채널 어댑터와 JDBC 아웃 바운드 어댑터 기반 메시지를 사용하여 소비 이러한 유형의 작업을 수행하는 방법의 예입니다. 퍼포먼스와 퍼포먼스에 영향을 미칠 수있는 몇 가지 핵심 사항은 다음과 같습니다.
- 거래 - 그것은 약간의 오버 헤드
- 변환을 추가 할 것입니다 데이터베이스에 큐를 통해 무슨 일 경우 - 얼마나 많은 처리가 테이블 여기
에 메시지 매핑 변환에 들어가는 것은 봄의 통합이다 예; 여기
<int-jms:message-driven-channel-adapter channel="trade.input.channel"
concurrent-consumers="1" connection-factory="connectionFactory"
destination="issue.queue"/>
<int:channel id="trade.input.channel"/>
<int-jdbc:outbound-channel-adapter
channel="trade.input.channel"
data-source="dataSource" query="insert into target_table (issue_code,issue_price,transaction_timestamp) values (:issue_code,:issue_price,:issue_timestamp)"
sql-parameter-source-factory="spelFactory"/>
<bean id="spelFactory" class="org.springframework.integration.jdbc.ExpressionEvaluatingSqlParameterSourceFactory">
<property name="parameterExpressions">
<map>
<entry key="issue_code" value="payload.toString().split(',')[0]"/>
<entry key="issue_price" value="payload.toString().split(',')[1]"/>
<entry key="issue_timestamp" value="payload.toString().split(',')[2]"/>
</map>
</property>
</bean>
및
샘플 메시지
MSFT,100.00,1373761697932
아주 거친, 그러나 출발점이 될 수에게 있습니다. 간단한 단위 테스트의 성능은 초당 평균 200 개의 메시지 였지만 하드웨어에 따라 조금씩 다릅니다.