Announcement Announcement Module
Collapse
No announcement yet.
JDBCMessageStore Can't handle multiple threads polling Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JDBCMessageStore Can't handle multiple threads polling

    I have a project that useed jms to keep messages between components. It worked well but I need to set up lots of queues and configuration is complicated. Now I try to use database MessageStore to take place of jms. It works well in single thread, but when I use multiple threads polling, each thread is very possible to get a same message and the result is a same message will be handled multiple times in different threads. The configuration is like this:

    Code:
    <bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
            <property name="corePoolSize" value="10" />
            <property name="maxPoolSize" value="20" />
            <property name="queueCapacity" value="500" />
    </bean>
    
    <jdbc:message-store id="messageStore" data-source="dataSource"/>
    
    <si:channel id="channel">
    	<si:queue capacity="500" message-store="messageStore"/>
    </si:channel>
    
    <si:service-activator ...>
    	<si:poller max-messages-per-poll="1" fixed-rate="2000" task-executor="taskExecutor">
    	     <si:transactional/>
    	</si:poller>
    </si:service-activator>
    I wrote some codes to implement my own messageStore based on JDBCMessageStore, but it is not efficient to handle a mass amount of messages, like 500 messages in a queue at the same time. I hope spring can provide a new messageStore implementation besides JDBCMessageStore.class that can do with multiple threads.

    In addtion, my application will have multiple instances running in different server to do the balance job. They have same database and messageStore configuration so that they are like multiple consumers to a queue. I will be very appreciated if you can consider this situation.

    Best regards.
Working...
X