Reputation: 13
I have the next configuration:
Inbound
<int:gateway id="inGateway" service-interface="XXX"
error-channel="errorChannel"
default-request-channel="requestChannel"
default-reply-channel="replyChannel" />
Outbound:
<ws:outbound-gateway id="ws-outbound-gateway"
request-channel="inbound" reply-channel="outbound" uri="XXX" />
Chain 1:
<int:chain input-channel="requestChannel" output-channel="inbound">
XXX </int:chain>
Chain 2:
<int:chain input-channel="outbound" output-channel="replyChannel"> XXX
</int:chain>
Error:
<int:chain input-channel="errorChannel" output-channel="replyChannel">
<int:transformer ref="logicTransformers" method="errorTransformerMethod"></int:transformer>
</int:chain>
</beans>
Java Transformer:
final GenericError errorCatalog = errorCatalog(errorMessage);
LOGGER.warn("Transformed error from catalog: {}", errorCatalog);
final MessageBuilder<Document> builder =
MessageBuilder.withPayload(XmlUtil.parseToDocument(errorCatalog)).copyHeaders(errorMessage.getHeaders()).copyHeadersIfAbsent(errorMessage.getHeaders());
When the webservice of outbound is down the error go into errorChannel transformer but to reponse we have the next error:
o.s.m.c.GenericMessagingTemplate$TemporaryReplyChannel#242 Reply message received but the receiving thread has exited due to an exception while sending the request message:GenericMessage [payload=[#document: null], headers={spanTraceId=8bf90ea9ff4266c8, spanId=598680bae5f913d5, spanParentSpanId=8bf90ea9ff4266c8, replyChannel=org.springframework.messaging.core.GenericMessagingTemplate$TemporaryReplyChannel@76c751de, functionalId=PRUEBASOA12, errorChannel=org.springframework.messaging.core.GenericMessagingTemplate$TemporaryReplyChannel@76c751de, messageSent=true, id=2108386f-99db-98b9-3d30-3bcf45335424, spanSampled=1, spanName=message:requestChannel}]
We don't understand... because we have the same flow with
Upvotes: 0
Views: 1128
Reputation: 121560
In case of error on the service level the original message is wrapped to the MessagingException
and the ErrorMessage
with that payload
is sent to the errorChannel
. Even if you use replyChannel
explicitly, you still have to ensure the replyChannel
header, which is populated by the inbound gateway. And exactly this header plays the main role in the request-reply behavior in that gateway.
That replyHeader
is still present in your error flow, but it is already a part of the failedMessage
in the MessagingException
payload.
So, your logicTransformers.errorTransformerMethod
should extract that replyChannel
header for the real reply from this method to be sent to the explicit replyChannel
. Or you can omit this replyChannel
at all because any way the real sendAndReceive
is based on the replyChannel
header.
Please, read more info in the Reference Manual:
Upvotes: 0