Top Description Fields Constructors Methods
org.springframework.messaging.support

public Class IdTimestampMessageHeaderInitializer

extends Object
implements MessageHeaderInitializer
Class Inheritance
All Implemented Interfaces
org.springframework.messaging.support.MessageHeaderInitializer
Imports
org.springframework.lang.Nullable, org.springframework.messaging.MessageHeaders, org.springframework.util.IdGenerator

A MessageHeaderInitializer to customize the strategy for ID and TIMESTAMP message header generation.
Author
Rossen Stoyanchev
Since
4.1

Field Summary

Modifier and TypeField and Description
private boolean
private static final IdGenerator
private IdGenerator

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public IdGenerator
getIdGenerator()

Return the configured IdGenerator, if any.

public void
initHeaders(MessageHeaderAccessor
the MessageHeaderAccessor to initialize
headerAccessor
)

Implements org.springframework.messaging.support.MessageHeaderInitializer.initHeaders.

Initialize the given MessageHeaderAccessor.

public boolean
isEnableTimestamp()

Return whether the timestamp header is enabled or not.

public void
setDisableIdGeneration()

A shortcut for calling setIdGenerator with an id generation strategy to disable id generation completely.

public void
setEnableTimestamp(boolean enableTimestamp)

Whether to enable the automatic addition of the org.springframework.messaging.MessageHeaders#TIMESTAMP header on MessageHeaderAccessor instances being initialized.

public void
setIdGenerator(IdGenerator idGenerator)

Configure the IdGenerator strategy to initialize MessageHeaderAccessor instances with.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

enableTimestampback to summary
private boolean enableTimestamp
ID_VALUE_NONE_GENERATORback to summary
private static final IdGenerator ID_VALUE_NONE_GENERATOR
idGeneratorback to summary
private IdGenerator idGenerator
Annotations
@Nullable

Constructor Detail

IdTimestampMessageHeaderInitializerback to summary
public IdTimestampMessageHeaderInitializer()

Method Detail

getIdGeneratorback to summary
public IdGenerator getIdGenerator()

Return the configured IdGenerator, if any.

Annotations
@Nullable
initHeadersback to summary
public void initHeaders(MessageHeaderAccessor headerAccessor)

Implements org.springframework.messaging.support.MessageHeaderInitializer.initHeaders.

Doc from org.springframework.messaging.support.MessageHeaderInitializer.initHeaders.

Initialize the given MessageHeaderAccessor.

Parameters
headerAccessor:MessageHeaderAccessor

the MessageHeaderAccessor to initialize

Annotations
@Override
isEnableTimestampback to summary
public boolean isEnableTimestamp()

Return whether the timestamp header is enabled or not.

setDisableIdGenerationback to summary
public void setDisableIdGeneration()

A shortcut for calling setIdGenerator with an id generation strategy to disable id generation completely.

setEnableTimestampback to summary
public void setEnableTimestamp(boolean enableTimestamp)

Whether to enable the automatic addition of the org.springframework.messaging.MessageHeaders#TIMESTAMP header on MessageHeaderAccessor instances being initialized.

By default this property is set to false.

setIdGeneratorback to summary
public void setIdGenerator(IdGenerator idGenerator)

Configure the IdGenerator strategy to initialize MessageHeaderAccessor instances with.

By default this property is set to null in which case the default IdGenerator of org.springframework.messaging.MessageHeaders is used.

To have no ids generated at all, see setDisableIdGeneration().