Class KafkaExpressionEvaluatingInterceptor

java.lang.Object
org.springframework.cloud.stream.binder.kafka.KafkaExpressionEvaluatingInterceptor
All Implemented Interfaces:
org.springframework.messaging.support.ChannelInterceptor

public class KafkaExpressionEvaluatingInterceptor extends Object implements org.springframework.messaging.support.ChannelInterceptor
Interceptor to evaluate expressions for outbound messages before serialization.
Since:
3.0
Author:
Gary Russell
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Name for the evaluated message key header.
  • Constructor Summary

    Constructors
    Constructor
    Description
    KafkaExpressionEvaluatingInterceptor(org.springframework.expression.Expression messageKeyExpression, org.springframework.expression.EvaluationContext evaluationContext)
    Construct an instance with the provided expressions and evaluation context.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.messaging.Message<?>
    preSend(org.springframework.messaging.Message<?> message, org.springframework.messaging.MessageChannel channel)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.messaging.support.ChannelInterceptor

    afterReceiveCompletion, afterSendCompletion, postReceive, postSend, preReceive
  • Field Details

    • MESSAGE_KEY_HEADER

      public static final String MESSAGE_KEY_HEADER
      Name for the evaluated message key header.
      See Also:
  • Constructor Details

    • KafkaExpressionEvaluatingInterceptor

      public KafkaExpressionEvaluatingInterceptor(org.springframework.expression.Expression messageKeyExpression, org.springframework.expression.EvaluationContext evaluationContext)
      Construct an instance with the provided expressions and evaluation context. At least one expression muse be non-null.
      Parameters:
      messageKeyExpression - the routing key expression.
      evaluationContext - the evaluation context.
  • Method Details

    • preSend

      public org.springframework.messaging.Message<?> preSend(org.springframework.messaging.Message<?> message, org.springframework.messaging.MessageChannel channel)
      Specified by:
      preSend in interface org.springframework.messaging.support.ChannelInterceptor