Announcement Announcement Module
Collapse
No announcement yet.
JDBC Inbound channel adapter direct to @router giving odd results Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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?

    Comment


    • #3
      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" />

      Comment

      Working...
      X