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

MessageBuilder should return the original Message anytime that no changes are made to the payload or headers

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: None
    • Fix Version/s: 2.0.5
    • Component/s: None
    • Labels:
      None

      Description

      Currently, the modified flag is set to true anytime setHeader, removeHeader, or copyHeaders are called. However, if those methods do not actually change the status of the Message being built in any way (e.g. remove a header that doesn't exist anyway), then the modified flag should NOT be set to true. When that modified flag is not set to true, a call to build() will return the original Message instance. Therefore, the following would work:

      Message<?> original = MessageBuilder.withPayload("foo").setHeader("bar", 42).build();
      Message<?> result = MessageBuilder.fromMessage(original).setHeader("bar", 42).removeHeader("notThere").build();
      assertEquals(original, result);
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mark.fisher Mark Fisher
                Reporter:
                mark.fisher Mark Fisher
              • Votes:
                1 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: