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 SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionorg.springframework.util.IdGeneratorReturn the configuredIdGenerator, if any.voidinitHeaders(MessageHeaderAccessor headerAccessor) Initialize the givenMessageHeaderAccessor.booleanReturn whether the timestamp header is enabled or not.voidA shortcut for callingsetIdGenerator(org.springframework.util.IdGenerator)with an id generation strategy to disable id generation completely.voidsetEnableTimestamp(boolean enableTimestamp) Whether to enable the automatic addition of theMessageHeaders.TIMESTAMPheader onMessageHeaderAccessorinstances being initialized.voidsetIdGenerator(org.springframework.util.IdGenerator idGenerator) Configure the IdGenerator strategy to initializeMessageHeaderAccessorinstances with.
- 
Constructor Details- 
IdTimestampMessageHeaderInitializerpublic IdTimestampMessageHeaderInitializer()
 
- 
- 
Method Details- 
setIdGeneratorpublic void setIdGenerator(@Nullable org.springframework.util.IdGenerator idGenerator) Configure the IdGenerator strategy to initializeMessageHeaderAccessorinstances with.By default this property is set to nullin which case the default IdGenerator ofMessageHeadersis used.To have no ids generated at all, see setDisableIdGeneration().
- 
getIdGenerator@Nullable public org.springframework.util.IdGenerator getIdGenerator()Return the configuredIdGenerator, if any.
- 
setDisableIdGenerationpublic void setDisableIdGeneration()A shortcut for callingsetIdGenerator(org.springframework.util.IdGenerator)with an id generation strategy to disable id generation completely.
- 
setEnableTimestamppublic void setEnableTimestamp(boolean enableTimestamp) Whether to enable the automatic addition of theMessageHeaders.TIMESTAMPheader onMessageHeaderAccessorinstances being initialized.By default this property is set to false. 
- 
isEnableTimestamppublic boolean isEnableTimestamp()Return whether the timestamp header is enabled or not.
- 
initHeadersDescription copied from interface:MessageHeaderInitializerInitialize the givenMessageHeaderAccessor.- Specified by:
- initHeadersin interface- MessageHeaderInitializer
- Parameters:
- headerAccessor- the MessageHeaderAccessor to initialize
 
 
-