Interface ErrorRegistry
- All Superinterfaces:
AutoCloseable, ErrorRegistryView, Service, StaticService
A registry which captures exceptions that occurred during message routing and stores them in memory.
This is an opt-in feature that must be enabled. When enabled, the registry captures error snapshots including
exception details, exchange data (headers, body, properties, variables), and routing context — without retaining
references to the original exchange objects.
The registry has a configurable maximum capacity and time-to-live to prevent unbounded memory growth and stale data.
The registry itself implements
ErrorRegistryView for global scope, and scoped views for individual routes can
be obtained via forRoute(String).- Since:
- 4.19
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionGets a view scoped to a specific route.intMaximum number of characters to keep for the message body (to prevent storing very big payloads).intThe maximum number of error entries to keep in the registryThe time-to-live for error entriesbooleanWhether to include message body from files.booleanWhether to include message body from streams.booleanWhether the error registry is enabledbooleanWhether to include exchange properties in the captured error data.booleanWhether to include exchange variables in the captured error data.voidsetBodyIncludeFiles(boolean bodyIncludeFiles) Sets whether to include message body from files.voidsetBodyIncludeStreams(boolean bodyIncludeStreams) Sets whether to include message body from streams.voidsetBodyMaxChars(int bodyMaxChars) Sets the maximum number of characters to keep for the message body.voidsetEnabled(boolean enabled) Sets whether the error registry is enabled.voidsetIncludeExchangeProperties(boolean includeExchangeProperties) Sets whether to include exchange properties.voidsetIncludeExchangeVariables(boolean includeExchangeVariables) Sets whether to include exchange variables.voidsetMaximumEntries(int maximumEntries) Sets the maximum number of error entries to keep.voidsetTimeToLive(Duration timeToLive) Sets the time-to-live for error entries.Methods inherited from interface ErrorRegistryView
browse, browse, clear, size
-
Method Details
-
forRoute
Gets a view scoped to a specific route. The returned view is a lightweight filter over the same underlying data.- Parameters:
routeId- the route id- Returns:
- a view containing only errors from the given route
-
isEnabled
boolean isEnabled()Whether the error registry is enabled -
setEnabled
void setEnabled(boolean enabled) Sets whether the error registry is enabled. This is by default disabled. -
getMaximumEntries
int getMaximumEntries()The maximum number of error entries to keep in the registry -
setMaximumEntries
void setMaximumEntries(int maximumEntries) Sets the maximum number of error entries to keep. When the limit is exceeded, the oldest entries are evicted. The default value is 100. -
getTimeToLive
Duration getTimeToLive()The time-to-live for error entries -
setTimeToLive
Sets the time-to-live for error entries. Entries older than this duration are evicted. The default value is 0 (disabled). Set to a positive duration to enable time-based eviction. -
getBodyMaxChars
int getBodyMaxChars()Maximum number of characters to keep for the message body (to prevent storing very big payloads). -
setBodyMaxChars
void setBodyMaxChars(int bodyMaxChars) Sets the maximum number of characters to keep for the message body. The default value is 32768 (32kb). -
isBodyIncludeStreams
boolean isBodyIncludeStreams()Whether to include message body from streams. -
setBodyIncludeStreams
void setBodyIncludeStreams(boolean bodyIncludeStreams) Sets whether to include message body from streams. This is by default disabled because reading from a stream is a destructive operation. -
isBodyIncludeFiles
boolean isBodyIncludeFiles()Whether to include message body from files. -
setBodyIncludeFiles
void setBodyIncludeFiles(boolean bodyIncludeFiles) Sets whether to include message body from files. This is by default enabled. -
isIncludeExchangeProperties
boolean isIncludeExchangeProperties()Whether to include exchange properties in the captured error data. -
setIncludeExchangeProperties
void setIncludeExchangeProperties(boolean includeExchangeProperties) Sets whether to include exchange properties. This is by default enabled. -
isIncludeExchangeVariables
boolean isIncludeExchangeVariables()Whether to include exchange variables in the captured error data. -
setIncludeExchangeVariables
void setIncludeExchangeVariables(boolean includeExchangeVariables) Sets whether to include exchange variables. This is by default enabled.
-