public class IdTimestampMessageHeaderInitializer extends java.lang.Object implements MessageHeaderInitializer
MessageHeaderInitializer
to customize the strategy for ID and TIMESTAMP message header generation.Modifier and Type | Field and Description |
---|---|
private boolean |
enableTimestamp |
private static IdGenerator |
ID_VALUE_NONE_GENERATOR |
private IdGenerator |
idGenerator |
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. |
private IdGenerator idGenerator
private boolean enableTimestamp
private static final IdGenerator ID_VALUE_NONE_GENERATOR
public void setIdGenerator(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 id's generated at all, see setDisableIdGeneration()
.
public void setDisableIdGeneration()
setIdGenerator(org.springframework.util.IdGenerator)
with an id generation strategy to disable id generation completely.public IdGenerator getIdGenerator()
IdGenerator
, if any.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