Results 1 to 3 of 3

Thread: question about message persistence ?

  1. #1

    Question question about message persistence ?

    Hi,every one.

    when using a queue channel, the config is like following
    Code:
    <int:channel id="queueChannel"> 
        <int:queue capacity="50" /> 
    </int:channel>
    How should I recover the message in the channel from sudden power off ? I mean, there are messages in the channel, and at the power off time, the endpoints connectting to the channel has not received the messages yet.

    I wonder if a channel can save the messages receives before it send them to its endpoint.The messages may be saved in a file, or a database and if necessary the channel can reread the messages.

    any help will be appriciated~

  2. #2
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    By default QueueChannel stores messages in memory, so you're right in the case of a crash, power-off etc., the messages are gonna be lost. However, you can use 'message-store' attribute on the 'queue' element to point to an implementation of the MessageStore strategy. We provide JdbcMessageStore allowing you to use RDBMS as a persistent store to back the QueueChannel. See more info here: http://static.springsource.org/sprin...-configuration

  3. #3

    Default

    thank oleg for quick answers.

    Here is my config of using jdbcmessagestore:

    Code:
    <int:poller default="true" max-messages-per-poll="1" fixed-rate="2000">
    </int:poller>
    	
    <int:channel id="dbBackedChannel">
    <int:queue  capacity="10"  message-store="messageStore" />
    </int:channel>
    <int-jdbc:message-store id="messageStore" data-source="myDataSource"/>
    <bean id="myDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
           <property name="driverClass" value="com.mysql.jdbc.Driver"/>
           <property name="jdbcUrl" value="jdbc:mysql://127.0.0.1:3306/test"/>
           <property name="user" value="ude"/>
           <property name="password" value="ude"/>
           <property name="initialPoolSize"><value>2</value></property>	
           <property name="minPoolSize"><value>1</value></property>
           <property name="maxPoolSize"><value>50</value></property>
           <property name="maxIdleTime"><value>1200</value></property>
           <property name="checkoutTimeout"><value>20000</value></property>
    </bean>
    <int:service-activator input-channel="dbBackedChannel"ref="messageHandler"></int:service-activator>
    <int:inbound-channel-adapter channel="dbBackedChannel"
    ref="messageProducer" method="produceMessage">
    </int:inbound-channel-adapter>
    And I have execute the ddl in database. Now It works fine, the message is stored in the table INT_MESSAGE_GROUP
    Last edited by xiaoyu1985ban; Jun 21st, 2011 at 01:40 AM.

Posting Permissions

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