Announcement Announcement Module
Collapse
No announcement yet.
when I use poller, how to know it reach the max-mesages-per-poll? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • when I use poller, how to know it reach the max-mesages-per-poll?

    Hi-
    I use the sample from ch17 and found polling is still message-driven.
    <jms:inbound-channel-adapter id="jmsIn" destination="inQueue" >
    <integrationoller max-messages-per-poll="30" >
    <integration:interval-trigger interval="30" time-unit="SECONDS"/>
    </integrationoller>
    </jms:inbound-channel-adapter>


    use this as an example,
    Without specify channel = xyz, deault is DirectChannel.
    it still send message to subscriber.
    and one message at a time.
    so handler can only handle one message at a time.
    My goal is hope to get 30 messages once and use array insert all 30 into database ont shot and one commit.
    if I only get one message at a time and add to my List, it is not much different than event driven since i dont know WHEN I reach 30 messages or timeout so I can go insert.

    any suggestion is very appreciate.
    thx

  • #2
    You might want to consider an aggregator (see the reference manual) or depending on the use-case, you might want to look at spring-batch.

    Comment


    • #3
      is there any other TransactionManager for jms other than JmsTransactionManager ?

      in 2.0 API, it seems like I can only get one connection and one session when I use JmsTransactionManager. API says
      ------------------------------------------
      This transaction strategy will typically be used in combination with SingleConnectionFactory, which uses a single JMS Connection for all JMS access in order to avoid the overhead of repeated Connection creation, typically in a standalone application. Each transaction will then share the same JMS Connection, while still using its own individual JMS Session.
      --------------------------------------------------

      transactionManager is required for this simple step bean. what is the best transaction manager for jms reader?

      I use JmsItemReader and setup a pool for taskExecutor but i dont see 10 readers running. The performance for this reader seems slow.
      It took 25 seconds to GET 400 MQ messages.
      here is my step:

      <bean id="helloStep" class="org.springframework.batch.core.step.item.Si mpleStepFactoryBean">
      <property name="transactionManager" ref="transactionManager"/>
      <property name="jobRepository" ref="jobRepository"/>
      <property name="itemReader" ref="jmsItemReader"/>
      <property name="itemProcessor" ref="tradeProcessor"></property>
      <property name="itemWriter" ref="writer"/>
      <property name="commitInterval" value="100"/>
      <property name="taskExecutor" ref="threadPoolTaskExec" />
      </bean>

      Comment

      Working...
      X