Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: SI Aggregator - Timeout release strategy

  1. #11
    Join Date
    Sep 2011
    Posts
    167

    Default

    Quote Originally Posted by SARAL SAXENA View Post
    Hi Amol,

    As you have said....



    PLEASE explain the concept of release strategy for a message group...as I am 100% clear on message reaper but not on message group..please if it is best you can tell with a example..!!
    Hi ,
    Is there is any way that I would configure only the release out startergy and I don't want to go for message reaper,,, I want that message group of 10 should be formed within 30 secnds and if somehow only 7 messages arrive in 30 seconds then those 7 messages group should be released ...can't release startergy alone handles this case itself..!!

  2. #12
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,021

    Default

    NO.

    As we have said to you before, the aggregator is a passive component and only acts when messages arrive. To activate it outside of message arrival, you need some other component (the reaper).
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  3. #13
    Join Date
    Sep 2011
    Posts
    167

    Default

    Quote Originally Posted by Gary Russell View Post
    NO.

    As we have said to you before, the aggregator is a passive component and only acts when messages arrive. To activate it outside of message arrival, you need some other component (the reaper).
    Hi Gary,

    As we can set the release startergy in the xml configuration file itself...like the below...

    Code:
    bean id="timeout"
    		class="org.springframework.integration.aggregator.TimeoutCountSequenceSizeReleaseStrategy">
    		<constructor-arg name="threshold" value="1000" />
    		<constructor-arg name="timeout" value="7000" />
    	</bean>
    Can we also define the corelation statergy bean also in xml file for grouping the messages according to same corelatioanal id...rite now in my application I am writing a separate pojo bean for corelational startergy and then passing it reference in aggregatoer in xml., I want thqt co relational startergy should also be there in xmll file itself just as the release startergy..!! is it possible could you please advise me and show some sample tags of that in the xml format..!!!

  4. #14
    Join Date
    Oct 2011
    Location
    Mumbai, India
    Posts
    213

    Default

    You can use a org.springframework.integration.aggregator.HeaderA ttributeCorrelationStrategy.
    Define a bean like


    Code:
            <bean id="correlationStrategy" class="org.springframework.integration.aggregator.HeaderAttributeCorrelationStrategy">
    		<constructor-arg value="CORRELATING_ID"/>
    	</bean>
    Give the reference to this bean using the correlation-strategy attribute of the aggregator definition in the config

    This will aggregate the messages based on the value of the header CORRELATING_ID in the message header

  5. #15
    Join Date
    Sep 2011
    Posts
    167

    Default

    Hi Amol,

    In my application I am using the corelation bean as follows....

    Code:
    import org.springframework.integration.Message;
    
    public class CorrelationBean {
    	//Not grouping based on correlation ids 
    	public String correlationStrategy(Message<String> request){
    		return "NO GROUPING";
    	}
    }
    As seen above technically I doing no grouping on the basis of id's and I am passing the refence of this pojo in my configuration as ..
    Code:
    <bean id="correlationBean" class="com.walgreens.ods.producer.CorrelationBean" scope="prototype" />
    <si:aggregator id="aggregator_2" input-channel="aggregator-input-channel_2" output-channel="aggregator-output-channel_2"
    		
    		ref="sampleAggregator" method="aggregateMessagaes"  		
    		correlation-strategy="correlationBean" correlation-strategy-method="correlationStrategy" 
    		release-strategy="releaseStrategyBean" release-strategy-method="releaseStrategy" 
    		message-store="messageStore2"
    		order="1" 
    		send-partial-result-on-expiry="true"		
    		send-timeout = "5000"
    		>
    	</si:aggregator>

    I want to remove this pojo and I want all the configuration in xml file itself as I have done of release statergy , please guide me how this above bean would be look like in the xml file itself..!! thanks in advance..!!

  6. #16
    Join Date
    Oct 2011
    Location
    Mumbai, India
    Posts
    213

    Default

    I don't get what you mean, haven't you defined the correlation strategy bean in the xml file too?

  7. #17
    Join Date
    Sep 2011
    Posts
    167

    Default

    Quote Originally Posted by Amol Nayak View Post
    I don't get what you mean, haven't you defined the correlation strategy bean in the xml file too?
    I have already made a seprate java bean for correlation strategy and passes it reference in the xml configuration file itself, Now I want it completeley in xml configuration file itself ..no java bean I want to keep ..!!

  8. #18
    Join Date
    Jul 2009
    Location
    Hyderabad India
    Posts
    56

    Default

    Hi Saral,

    You can configure it via the correlation-strategy-expression attribute (correlation logic via a SpEL expression) instead of correlation-strategy attribute. Something like (example taken from reference manual)

    Code:
    correlation-strategy-expression="payload.person.id"
    Similarly for ReleaseStrategy
    Code:
    release-strategy-expression="payload.size() gt 5"
    Here you don't have to write beans, you can use SpEL to define your correlation and release strategy

    Other thing that I observe is that with MessageGroupStoreReaper we can use MethodInvokingReleaseStrategy instead of TimeoutCountSequenceSizeReleaseStrategy. Write a bean and method that always return false. (I want all the messages to be released / expired at fixed interval)

    Code:
            <bean id="myReleaseStrategy" class="com.test.MyReleaseStrategy" />
    	
    	<bean id="releaseStrategy"
    		class="org.springframework.integration.aggregator.MethodInvokingReleaseStrategy">
    		<constructor-arg name="object" ref="myReleaseStrategy" />
    		<constructor-arg name="methodName" value="canRelease" />
    	</bean>
    Code:
    public class MyReleaseStrategy {
    	public boolean canRelease() {
    		System.out.println("MyReleaseStrategy.canRelease called .....");
    		return false;
    	}
    }
    Regards,
    Pranav
    Last edited by Pranav Kumar Varshney; Nov 29th, 2011 at 12:08 AM.

  9. #19
    Join Date
    Sep 2011
    Posts
    167

    Default

    Hi Pranav ,
    Thanks for the explnation it is working now,I done the corelational-startergy expression attribute via SPEL itself and it's working..!!Thanks a lot..!!
    Last edited by SARAL SAXENA; Nov 29th, 2011 at 12:57 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
  •