Class IdTimestampMessageHeaderInitializer
java.lang.Object
org.springframework.messaging.support.IdTimestampMessageHeaderInitializer
- All Implemented Interfaces:
MessageHeaderInitializer
A
MessageHeaderInitializer
to customize the strategy for ID and TIMESTAMP message header generation.- Since:
- 4.1
- Author:
- Rossen Stoyanchev
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturn the configuredIdGenerator
, if any.void
initHeaders
(MessageHeaderAccessor headerAccessor) Initialize the givenMessageHeaderAccessor
.boolean
Return whether the timestamp header is enabled or not.void
A shortcut for callingsetIdGenerator(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 theMessageHeaders.TIMESTAMP
header onMessageHeaderAccessor
instances being initialized.void
setIdGenerator
(IdGenerator idGenerator) Configure the IdGenerator strategy to initializeMessageHeaderAccessor
instances with.
-
Constructor Details
-
IdTimestampMessageHeaderInitializer
public IdTimestampMessageHeaderInitializer()
-
-
Method Details
-
setIdGenerator
Configure the IdGenerator strategy to initializeMessageHeaderAccessor
instances with.By default this property is set to
null
in which case the default IdGenerator ofMessageHeaders
is used.To have no ids generated at all, see
setDisableIdGeneration()
. -
getIdGenerator
Return the configuredIdGenerator
, if any. -
setDisableIdGeneration
public void setDisableIdGeneration()A shortcut for callingsetIdGenerator(org.springframework.util.IdGenerator)
with an id generation strategy to disable id generation completely. -
setEnableTimestamp
public void setEnableTimestamp(boolean enableTimestamp) Whether to enable the automatic addition of theMessageHeaders.TIMESTAMP
header onMessageHeaderAccessor
instances being initialized.By default this property is set to false.
-
isEnableTimestamp
public boolean isEnableTimestamp()Return whether the timestamp header is enabled or not. -
initHeaders
Description copied from interface:MessageHeaderInitializer
Initialize the givenMessageHeaderAccessor
.- Specified by:
initHeaders
in interfaceMessageHeaderInitializer
- Parameters:
headerAccessor
- the MessageHeaderAccessor to initialize
-