Interface CloudEventHeaderEnricher

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface CloudEventHeaderEnricher
    Strategy that should be implemented by the user to help with outgoing Cloud Event headers.

    NOTE: The provided instance of CloudEventMessageBuilder may or may not be initialized with default values, so it is the responsibility of the user to ensure that all required Cloud Events attributes are set. That said, Spring frameworks which utilize this interface will ensure that the provided CloudEventMessageBuilder is initialized with default values, leaving you responsible to only set the attributes you need.
    Once implemented, simply configure it as a bean and the framework will invoke it before the outbound Cloud Event Message is finalized.
     @Bean
     public CloudEventHeaderEnricher cloudEventHeaderEnricher() {
      return headers -> {
       return headers.setSource("https://interface21.com/").setType("com.interface21");
      };
     }
     
    Since:
    3.1
    Author:
    Oleg Zhurakousky, Dave Syer