INT-4257-2: Document ErrorMessagePublisher
JIRA: https://jira.spring.io/browse/INT-4257 * Remove deprecated `EnhancedErrorMessage` * Document `ErrorMessagePublisher` and `ErrorMessageStrategy` * Fix Reactor version to `3.1` in Doc * Fix sample about Reactive Streams in the `router.adoc`
This commit is contained in:
committed by
Gary Russell
parent
f7f7bdd067
commit
71b93987d7
@@ -195,6 +195,15 @@ To enable global error handling, simply register a handler on that channel.
|
||||
For example, you can configure Spring Integration's `ErrorMessageExceptionTypeRouter` as the handler of an endpoint that is subscribed to the 'errorChannel'.
|
||||
That router can then spread the error messages across multiple channels based on `Exception` type.
|
||||
|
||||
Starting with _version 4.3.10_, the `ErrorMessagePublisher` and the `ErrorMessageStrategy` are provided.
|
||||
They can be used as general mechanism for publishing `ErrorMessage` s and can be called or extended in any error handling scenarios.
|
||||
The `ErrorMessageSendingRecoverer` extends this class as a `RecoveryCallback` implementation that can be used with retry, such as the
|
||||
<<retry-advice, RequestHandlerRetryAdvice>>.
|
||||
The `ErrorMessageStrategy` is used to build an `ErrorMessage` based on the provided exception and an `AttributeAccessor` context.
|
||||
It can be injected to any `MessageProducerSupport` and `MessagingGatewaySupport` - and the `requestMessage` is stored under `ErrorMessageUtils.INPUT_MESSAGE_CONTEXT_KEY` in the `AttributeAccessor` context.
|
||||
The `ErrorMessageStrategy` can use that `requestMessage` as the `originalMessage` property of the `ErrorMessage` it creates.
|
||||
The `DefaultErrorMessageStrategy` does exactly that.
|
||||
|
||||
[[global-properties]]
|
||||
=== Global Properties
|
||||
|
||||
|
||||
@@ -1380,18 +1380,12 @@ public PollableChannel resultsChannel() {
|
||||
public RoutingSlipRouteStrategy routeStrategy() {
|
||||
return (requestMessage, reply) -> requestMessage.getPayload() instanceof String
|
||||
? new FixedSubscriberChannel(m ->
|
||||
Streams.defer((String) m.getPayload())
|
||||
.env(this.reactorEnv)
|
||||
.get()
|
||||
Mono.just((String) m.getPayload())
|
||||
.map(String::toUpperCase)
|
||||
.consume(v -> messagingTemplate().convertAndSend(resultsChannel(), v))
|
||||
.flush())
|
||||
.subscribe(v -> messagingTemplate().convertAndSend(resultsChannel(), v)))
|
||||
: new FixedSubscriberChannel(m ->
|
||||
Streams.defer((Integer) m.getPayload())
|
||||
.env(this.reactorEnv)
|
||||
.get()
|
||||
Mono.just((Integer) m.getPayload())
|
||||
.map(v -> v * 2)
|
||||
.consume(v -> messagingTemplate().convertAndSend(resultsChannel(), v))
|
||||
.flush());
|
||||
.subscribe(v -> messagingTemplate().convertAndSend(resultsChannel(), v)));
|
||||
}
|
||||
----
|
||||
|
||||
@@ -37,11 +37,15 @@ See <<http-outbound>> for more information.
|
||||
Now that we use the new `InvocableHandlerMethod` -based infrastructure for service method invocations, we can perform `contentType` conversion from payload to target method argument.
|
||||
See <<content-type-conversion>> for more information.
|
||||
|
||||
==== ErrorMessagePublisher and ErrorMessageStrategy
|
||||
|
||||
The `ErrorMessagePublisher` abd the `ErrorMessageStrategy` are provided for creating `ErrorMessage` instances.
|
||||
See <<namespace-errorhandler>> for more information.
|
||||
|
||||
[[x5.0-general]]
|
||||
=== General Changes
|
||||
|
||||
Spring Integration is now fully based on Spring Framework `5.0` and Project Reactor `3.0`.
|
||||
Spring Integration is now fully based on Spring Framework `5.0` and Project Reactor `3.1`.
|
||||
Previous Project Reactor versions are no longer supported.
|
||||
|
||||
==== Core Changes
|
||||
|
||||
Reference in New Issue
Block a user