Announcement Announcement Module
Collapse
No announcement yet.
Aggregator and Persistent MessageStore Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Aggregator and Persistent MessageStore

    Warning, I am a Spring Integration Newbie, . . .

    I am trying to accomplish something very similar to this thread post using a Persistent Memory Store

    http://forum.springsource.org/showth...t=messageStore

    I am a little confused as to the when the message store is written to.

    I have setup a case where I have hard coded the correlation strategy to always return "100" and the release strategy to always be false. I expected to see an entry in the database. But nothing shows up.

    So I would like to request some help understanding when the messages are saved to the persistent message store.

    Code:
    <aggregator id="poslogAggregator" 
    	    input-channel="aggregatorChannel"
    		output-channel="foutputChannel" 
    		ref="aggregatorBean" method="add"
    		send-partial-result-on-expiry="false" 
    		message-store="persistentMessageStore"
    		correlation-strategy="aggregatorBean" 
    		correlation-strategy-method="correlate"
    		release-strategy="aggregatorBean" 
    		release-strategy-method="canRelease"
    		 />
    
    	<beans:bean id="dataSource" class="org.apache.tomcat.dbcp.dbcp.BasicDataSource" destroy-method="close">
            <beans:property name="driverClassName" value="${jdbc.driverClassName}"/>
            <beans:property name="url" value="${jdbc.url}"/>
            <beans:property name="username" value="${jdbc.username}"/>
            <beans:property name="password" value="${jdbc.password}"/>
        </beans:bean>
        
        <jdbc:message-store id="persistentMessageStore" data-source="dataSource"/>
    
    
    
    -------
    
    
       public boolean canRelease(List<List<String>> records) {
        	System.out.println("In canRelease: "+records.size());
        	System.out.println("records "+records.get(0));
        	boolean release = false;
        	if (records.size() >= 2) {
        		release = true;
        	}
        	System.out.println("release "+release);
        	return release;
        }
        
        public String correlate(List<List<String>> records) {
        	System.out.println("In corelate "+records);
        	return "101";
        }
    Any insights are appreciated.

    Jim

  • #2
    Reading more stuff in the forum, . . . . Found out that I may be getting caught up in some aggregator bugs: https://jira.springsource.org/browse/INT-2009 to https://jira.springsource.org/browse/INT-2014

    I found that my messages instead of going to the MessageStore were hitting the discardChannel

    Found it by adding the following


    Code:
    	<aggregator id="poslogAggregator" 
    	    input-channel="aggregatorChannel"
    		output-channel="foutputChannel" 
    		discard-channel="discardChannelLogger"
    ...
    
    	<logging-channel-adapter id="discardChannelLogger" 
    	    expression="'#### DiscardChannelLogger: ' + #this"
    	   />

    Comment

    Working...
    X