Class KafkaMessageHeaderAccessor
java.lang.Object
org.springframework.messaging.support.MessageHeaderAccessor
org.springframework.kafka.support.KafkaMessageHeaderAccessor
A header accessor to provide convenient access to certain headers in a
 type specific manner.
- Since:
- 3.0.10
- Author:
- Gary Russell
- 
Field SummaryFields inherited from class org.springframework.messaging.support.MessageHeaderAccessorDEFAULT_CHARSET
- 
Constructor SummaryConstructorsConstructorDescriptionKafkaMessageHeaderAccessor(Message<?> message) Construct an instance for the provided message.
- 
Method SummaryModifier and TypeMethodDescriptionprotected MessageHeaderAccessorcreateAccessor(Message<?> message) intAccess the header value when the blocking delivery attempt header is present.<T> @Nullable TGet a header value with a specific type.intWhen using non-blocking retries, get the delivery attempt header value as an int.static KafkaMessageHeaderAccessorCreate an instance from the payload and headers of the given Message.Methods inherited from class org.springframework.messaging.support.MessageHeaderAccessorcopyHeaders, copyHeadersIfAbsent, fromMap, fromMessageHeaders, getAccessor, getAccessor, getAccessor, getContentType, getDetailedLogMessage, getDetailedPayloadLogMessage, getErrorChannel, getHeader, getId, getMessageHeaders, getMutableAccessor, getReplyChannel, getShortLogMessage, getShortPayloadLogMessage, getTimestamp, isModified, isMutable, isReadableContentType, isReadOnly, removeHeader, removeHeaders, setContentType, setErrorChannel, setErrorChannelName, setHeader, setHeaderIfAbsent, setImmutable, setLeaveMutable, setModified, setReplyChannel, setReplyChannelName, toMap, toMessageHeaders, toString, verifyType
- 
Constructor Details- 
KafkaMessageHeaderAccessorConstruct an instance for the provided message.- Parameters:
- message- the message.
 
 
- 
- 
Method Details- 
getBlockingRetryDeliveryAttemptpublic int getBlockingRetryDeliveryAttempt()Access the header value when the blocking delivery attempt header is present.- Returns:
- The decoded header value if the header is present.
- Throws:
- IllegalStateException- if the header is not present.
- See Also:
 
- 
getNonBlockingRetryDeliveryAttemptpublic int getNonBlockingRetryDeliveryAttempt()When using non-blocking retries, get the delivery attempt header value as an int.- Returns:
- 1 if there is no header present; the decoded header value otherwise.
 
- 
getHeaderGet a header value with a specific type.- Type Parameters:
- T- the type.
- Parameters:
- key- the header name.
- type- the type's- Class.
- Returns:
- the value, if present.
- Throws:
- IllegalArgumentException- if the type is not correct.
 
- 
createAccessor- Overrides:
- createAccessorin class- MessageHeaderAccessor
 
- 
wrapCreate an instance from the payload and headers of the given Message.- Parameters:
- message- the message.
- Returns:
- the accessor.
 
 
-