Class HeaderEnricher

java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.transformer.HeaderEnricher
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, ExpressionCapable, IntegrationPattern, NamedComponent, GenericTransformer<org.springframework.messaging.Message<?>,org.springframework.messaging.Message<?>>, Transformer

public class HeaderEnricher extends IntegrationObjectSupport implements Transformer, IntegrationPattern
A Transformer that adds statically configured header values to a Message. Accepts the boolean 'overwrite' property that specifies whether values should be overwritten. By default, any existing header values for a given key, will not be replaced.
  • Constructor Details

    • HeaderEnricher

      public HeaderEnricher()
    • HeaderEnricher

      public HeaderEnricher(Map<String,? extends HeaderValueMessageProcessor<?>> headersToAdd)
      Create a HeaderEnricher with the given map of headers.
      Parameters:
      headersToAdd - The headers to add.
  • Method Details

    • setMessageProcessor

      public <T> void setMessageProcessor(MessageProcessor<T> messageProcessor)
    • setDefaultOverwrite

      public void setDefaultOverwrite(boolean defaultOverwrite)
    • setShouldSkipNulls

      public void setShouldSkipNulls(boolean shouldSkipNulls)
      Specify whether null values, such as might be returned from an expression evaluation, should be skipped. The default value is true. Set this to false if a null value should trigger removal of the corresponding header instead.
      Parameters:
      shouldSkipNulls - true when null values should be skipped.
    • getComponentType

      public String getComponentType()
      Description copied from class: IntegrationObjectSupport
      Subclasses may implement this method to provide component type information.
      Specified by:
      getComponentType in interface NamedComponent
      Overrides:
      getComponentType in class IntegrationObjectSupport
    • getIntegrationPatternType

      public IntegrationPatternType getIntegrationPatternType()
      Description copied from interface: IntegrationPattern
      Return a pattern type this component implements.
      Specified by:
      getIntegrationPatternType in interface IntegrationPattern
      Returns:
      the IntegrationPatternType this component implements.
    • onInit

      public void onInit()
      Description copied from class: IntegrationObjectSupport
      Subclasses may implement this for initialization logic.
      Overrides:
      onInit in class IntegrationObjectSupport
    • transform

      public org.springframework.messaging.Message<?> transform(org.springframework.messaging.Message<?> message)
      Specified by:
      transform in interface GenericTransformer<org.springframework.messaging.Message<?>,org.springframework.messaging.Message<?>>
      Specified by:
      transform in interface Transformer