spring integration - Do transactional pollers that use task-executors use database resources for queued messages -


i have service-activator uses poller pull messages channel. channel has queue backed persistent store database. poller configured task-executor in order add concurrency message processing channel.

the task-executor configured queue-capacity.

since poller retrieves messages channel database , configured transactional, happens transactions messages queued in task-executor if task-executor has no more threads available. requests on task-executor thread queued , since these messages have no thread of own, happens transaction? assume removal of messages persistent channel store poller queued (in) task executor committed. if server fails while has queued runnables queued in task executor lost?

since idea of transactional persistent channel queue ensure no messages lost in case server goes down, how queued messages (in task-executor) handled in terms of transactions active on channels database backed queue/store ?

    <bean id="store" class="org.springframework.integration.jdbc.store.jdbcchannelmessagestore">     <property name="datasource" ref="channelserverdatasource"/>     <property name="channelmessagestorequeryprovider" ref="queryprovider"/>     <property name="region" value="${user.name}_${channel.queue.region:default}"/>     <property name="usingidcache" value="false"/> </bean>   <int:transaction-synchronization-factory id="syncfactory">     <int:after-commit expression="@store.removefromidcache(headers.id.tostring())" />     <int:after-rollback expression="@store.removefromidcache(headers.id.tostring())"/>  </int:transaction-synchronization-factory>  <int:channel id="transacitonasyncservicequeue">     <int:queue message-store="store"/>      <!--  <int:queue/>  -->  </int:channel>  <bean id="rxpollingtrigger" class="org.springframework.scheduling.support.periodictrigger">     <constructor-arg value="500"/>     <constructor-arg value="milliseconds"/>     <property name = "initialdelay" value = "30000"/>      <!-- initialdelay important ensure channel doesnt start processing before datasources have been initialised becuase          persist transactions in queue, @ startup (restart) there maybe ready go processed before          connection pools have been created happens when servlet first hit --> </bean>   <int:service-activator ref="asyncchannelreceiver" method="processmessage" input-channel="transacitonasyncservicequeue">     <int:poller trigger="rxpollingtrigger" max-messages-per-poll="20"  task-executor="taskexecutor" receive-timeout="400">         <int:transactional transaction-manager="transactionmanagerasyncchannel" />      </int:poller>     <int:request-handler-advice-chain>         <ref bean="databasesessioncontext" />     </int:request-handler-advice-chain> </int:service-activator>  <task:executor id="taskexecutor" pool-size="100-200" queue-capacity="200" keep-alive="1" rejection-policy="caller_runs" />   

...then happens transactions messages queued in task-executor if task-executor has no more threads available. requests on task-executor thread queued , since these messages have no thread of own, happens transaction?

it doesn't work way - transaction doesn't start until task executed (including receive() channel).

the poller schedules task, task starts, transaction starts, work proceeds, transaction committed/rolled back.

see abstractpollingendpoint - pollingtask.call() transaction starts.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -