INT-3816: Superclass Mapping for EMExcTypeRouter
JIRA: https://jira.spring.io/browse/INT-3816 Add `cause` `supperclass` mapping ability to the `ErrorMessageExceptionTypeRouter` Address PR comments: Introduce `classNameMappings` to store exception classes on the mapping population. Override all `@ManagedOperation` s to modify `classNameMappings` as well. Address PR comments: * Remove redundant local variable * Fix concurrency access around `channelMapping` * Add `ClassNotFoundException` test for the `ErrorMessageExceptionTypeRouter` * Add `What's New` note about the `ClassNotFoundException` during init Get rid of `synchronized`, use atomic changes Additional polishing to avoid `ConcurrentModificationException ` Polishing
This commit is contained in:
committed by
Gary Russell
parent
1760572c8b
commit
2d33495437
@@ -959,7 +959,13 @@ As such, please read chapter _<<xml-xpath-routing>>_
|
||||
Spring Integration also provides a special type-based router called `ErrorMessageExceptionTypeRouter` for routing Error Messages (Messages whose `payload` is a `Throwable` instance).
|
||||
`ErrorMessageExceptionTypeRouter` is very similar to the `PayloadTypeRouter`.
|
||||
In fact they are almost identical.
|
||||
The only difference is that while `PayloadTypeRouter` navigates the instance hierarchy of a payload instance (e.g., `payload.getClass().getSuperclass()`) to find the most specific type/channel mappings, the `ErrorMessageExceptionTypeRouter` navigates the hierarchy of 'exception causes' (e.g., `payload.getCause()`) to find the most specific `Throwable` type/channel mappings.
|
||||
The only difference is that while `PayloadTypeRouter` navigates the instance hierarchy of a payload instance (e.g., `payload.getClass().getSuperclass()`) to find the most specific type/channel mappings,
|
||||
the `ErrorMessageExceptionTypeRouter` navigates the hierarchy of 'exception causes' (e.g., `payload.getCause()`)
|
||||
to find the most specific `Throwable` type/channel mappings and uses `mappingClass.isInstance(cause)` to match the
|
||||
`cause` to the class or any super class.
|
||||
|
||||
NOTE: Since _version 4.3_ the `ErrorMessageExceptionTypeRouter` loads all mapping classes during the initialization
|
||||
phase to fail-fast for a `ClassNotFoundException`.
|
||||
|
||||
Below is a sample configuration for `ErrorMessageExceptionTypeRouter`.
|
||||
|
||||
|
||||
@@ -97,3 +97,12 @@ See <<http-inbound>> for more information.
|
||||
|
||||
A new factory bean is provided to simplify the configuration of Jsch proxies for SFTP.
|
||||
See <<sftp-proxy-factory-bean>> for more information.
|
||||
|
||||
==== Routers Changes
|
||||
|
||||
The `ErrorMessageExceptionTypeRouter` supports now the `Exception` superclass mappings to avoid duplication
|
||||
for the same channel in case of several inheritors.
|
||||
For this purpose the `ErrorMessageExceptionTypeRouter` loads mapping classes during initialization to fail-fast
|
||||
for a `ClassNotFoundException`.
|
||||
|
||||
See <<router>> for more information.
|
||||
|
||||
Reference in New Issue
Block a user