Après le séparateur, une exception se produit lors du traitement d'un message. Je veux traiter cette exception et diriger vers le canal commun un nouveau message avec l'identifiant de corrélation de ce message qui a produit l'exception et un en-tête spécial qui indique l'erreur.Comment guider un nouveau message qui contient l'ID de corrélation actuel dans un flux d'exception
Je l'ai essayé de cette façon:
@Bean
public IntegrationFlow socialMediaErrorFlow() {
return IntegrationFlows.from("socialMediaErrorChannel")
.wireTap(sf -> sf.handle("errorService", "handleException"))
.handle((p, h) -> MessageBuilder.withPayload(p).copyHeaders(h).setHeader("ERROR", true).build())
.channel("directChannel_2")
.get();
}
Mais les agrégateurs renvoie cette erreur:
MessageHandlingException: error occurred in message handler [org.springframework.integration.dsl.AggregatorSpec$InternalAggregatingMessageHandler#0]; nested exception is java.lang.IllegalStateException: Null correlation not allowed. Maybe the CorrelationStrategy is failing?
Je ne peux pas copier l'ID de corrélation dans l'en-tête du message.
Est-ce que quelqu'un sait que je fais mal? Merci d'avance.