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

Let GenericHandler receive MessageHeaders instead of Map

    XMLWordPrintable

    Details

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

      Description

      When writing a GenericHandler lambda, the received headers are a Map, which often requires type handling of the header value:

      .<String>handle((p, h) -> h.get("myHeader")) // Object needs cast to be useful
      

      Suggest to change GenericHandler to:

      public interface GenericHandler<P> {
       Object handle(P payload, MessageHeaders headers);
      }

      so that h.get("myHeader", MyHeader.class) could be used to get a typed header value. The change would be compatible for implementers of a GenericHandler since MessageHeaders is a Map<String, Object>.

        Attachments

          Activity

            People

            Assignee:
            abilan Artem Bilan
            Reporter:
            dschulten Dietrich Schulten
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: