Uploaded image for project: 'Spring Integration'
  1. Spring Integration
  2. INT-1912

The release-strategy-expression attribute shows the wrong SpEL expression in documentation.

    Details

      Description

      Given the following configuration:

      <aggregator ref="auditLogger" method="aggregate" input-channel="auditChannel"
                      release-strategy-expression="payload.size() eq 2"
                      correlation-strategy-expression="headers[id]"/>
      

      The following exception occurs:

      java.lang.IllegalStateException: Null correlation not allowed.  Maybe the CorrelationStrategy is failing?
      	at org.springframework.util.Assert.state(Assert.java:384) ~[spring-core-3.0.5.RELEASE.jar:3.0.5.RELEASE]
      	at org.springframework.integration.aggregator.CorrelatingMessageHandler.handleMessageInternal(CorrelatingMessageHandler.java:160) ~[spring-integration-core-2.0.3.RELEASE.jar:na]
      	at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78) ~[spring-integration-core-2.0.3.RELEASE.jar:na]
      	... 46 common frames omitted
      

      The same occurs with changes in case to the correlation-strategy-expression, adding quotes around the id key, and headers that are either standard or non-standard.

      Meanwhile, if correlation-strategy-expression is replaced with equivalent code while the release-strategy-expression remains, then the aggregator is simply never reached--presumably because the release strategy never works out to true.

      Replacing both SpEL expressions with their presumed code equivalents as follows fixes the issue:

          @ReleaseStrategy
          public boolean isReadyToRelease(List<Message<?>> messages) {
              return messages.size() == 2;
          }
      
      
          @CorrelationStrategy
          public String correlateBy(@Header("id") String id) {
              return id;
          }
      

      I will note finally that the message is an HTTP message in case that matters.

        Attachments

          Activity

            People

            • Assignee:
              oleg.zhurakousky@springsource.com Oleg Zhurakousky
              Reporter:
              neilac333 Neil Chaudhuri
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: