public class IdTimestampMessageHeaderInitializer extends java.lang.Object implements MessageHeaderInitializer
MessageHeaderInitializer
to customize the strategy for ID and TIMESTAMP message header generation.Constructor and Description |
---|
IdTimestampMessageHeaderInitializer() |
Modifier and Type | Method and Description |
---|---|
IdGenerator |
getIdGenerator()
Return the configured
IdGenerator , if any. |
void |
initHeaders(MessageHeaderAccessor headerAccessor)
Initialize the given
MessageHeaderAccessor . |
boolean |
isEnableTimestamp()
Return whether the timestamp header is enabled or not.
|
void |
setDisableIdGeneration()
A shortcut for calling
setIdGenerator(org.springframework.util.IdGenerator) with an id generation strategy
to disable id generation completely. |
void |
setEnableTimestamp(boolean enableTimestamp)
Whether to enable the automatic addition of the
MessageHeaders.TIMESTAMP header on
MessageHeaderAccessor instances being initialized. |
void |
setIdGenerator(IdGenerator idGenerator)
Configure the IdGenerator strategy to initialize
MessageHeaderAccessor
instances with. |
public void setIdGenerator(@Nullable IdGenerator idGenerator)
MessageHeaderAccessor
instances with.
By default this property is set to null
in which case the default
IdGenerator of MessageHeaders
is used.
To have no ids generated at all, see setDisableIdGeneration()
.
@Nullable public IdGenerator getIdGenerator()
IdGenerator
, if any.public void setDisableIdGeneration()
setIdGenerator(org.springframework.util.IdGenerator)
with an id generation strategy
to disable id generation completely.public void setEnableTimestamp(boolean enableTimestamp)
MessageHeaders.TIMESTAMP
header on
MessageHeaderAccessor
instances being initialized.
By default this property is set to false.
public boolean isEnableTimestamp()
public void initHeaders(MessageHeaderAccessor headerAccessor)
MessageHeaderInitializer
MessageHeaderAccessor
.initHeaders
in interface MessageHeaderInitializer
headerAccessor
- the MessageHeaderAccessor to initialize