Results 1 to 3 of 3

Thread: JDBC Inbound channel adapter direct to @router giving odd results

  1. #1
    Join Date
    Apr 2012
    Posts
    13

    Default JDBC Inbound channel adapter direct to @router giving odd results

    Hello,

    I have a JDBC inbound channel adapter with the target as a router channel. For some reason, only the first row is being sent to the router. My query takes all the rows with status as "new" and marks them as "processing" then it should send the rows (which are mapped to objects using a row mapper) to the router method. The router should send to the right SA for processing, then the SA should update the row as "SUCCESSFUL" or "FAILED." In my case, only the first row is being processed, and marked as "successful" and the subsequent rows are remaining in a "processing" state. Should I be using something between my inbound adapter and the router? Am I not able to directly send the List of objects to my router? Please advise (code snippet below) --

    Code:
    <jdbc:inbound-channel-adapter
    		query="${transaction.query}"
    		max-rows-per-poll="${max.rows}" channel="transactions"
    		data-source="dataSource"
    		update="${update.query}"
    		row-mapper="rowMapper">
    		<poller fixed-rate="${poll.rate}">
    			<transactional />
    		</poller>
    	</jdbc:inbound-channel-adapter>
    
            <beans:bean id="rowMapper"
    		class="com.bakeshop.integration.poller.SweetsTransactionRowMapper" />
    
    	<channel id="transactions">
    		<dispatcher task-executor="wmTaskExecutor" />
    		<interceptors>
    			<wire-tap channel="logger" />
    		</interceptors>
    	</channel>
    
    	<logging-channel-adapter id="logger" level="ERROR" />
    
    	<channel id="cakes" />
    	<channel id="cookies" />
    
    	<channel id="cakeBaker" />
    	<channel id="cookieBaker" />
    
    	<bridge input-channel="cakes" output-channel="cakeBaker" />
    	<bridge input-channel="cookies" output-channel="cookieBaker" />
    
            <stream:stdout-channel-adapter id="deliveries" />
    
    	<service-activator input-channel="cakeBaker"
    		ref="requestProcessor" method="prepareCake"
    		output-channel="deliveries">
    		<task:executor id="cake-pool" pool-size="${cake.pool}" />
    	</service-activator>
    
    	<service-activator input-channel="cookieBaker"
    		ref="requestProcessor" method="prepareCookie" output-channel="deliveries">
    		<task:executor id="cookie-pool" pool-size="${cookie.pool}" />
    	</service-activator>
    
    	<beans:bean id="wmTaskExecutor"
    		class="org.springframework.scheduling.commonj.WorkManagerTaskExecutor">
    		<beans:property name="workManagerName" value="wm/baker" />
    	</beans:bean>
    
    	<!-- Dozer mapper -->
    	<beans:bean id="mapper" class="org.dozer.DozerBeanMapper"
    		scope="singleton" />

  2. #2
    Join Date
    Apr 2012
    Posts
    13

    Default

    I thought I could bypass the Splitter if I used the row mapper and returned the list of transaction objects, but I'm looking around and it seems I might have to use the Splitter between the poller and the router. True or False?

  3. #3
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,017

    Default

    You either need a splitter, or set max-rows-per-poll to 1.

    Using a splitter is much more efficient.

    The splitter doesn't need any sophistication; just <splitter input-channel="fromDb" output-channel="transactions" />
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •