I am trying to copy some data to another channel using wireTap. this is my code:
@Bean
public IntegrationFlow flow() {
return IntegrationFlows.from(Http.inboundGateway("/foo")
.requestMapping(m -> m.methods(HttpMethod.POST)
.transform(Transformers.objectToString())
.enrichHeaders(h -> h.headerExpression())
.transform(new ObjectTransformation()).wireTap("subChannel")
.get();
}
I have made a subscribtion channel and a loggerHandler as well
@Bean
public SubscribableChannel subscribeChannel() {
return MessageChannels.publishSubscribe("subChannel")
.get();
}
public LoggingHandler logger() {
LoggingHandler logger = new LoggingHandler(Level.INFO);
return logger;
}
I also created a flow to log the copied data :
@Bean
public IntegrationFlow subscribeFlow() {
return IntegrationFlows.from("subChannel")
.handle(logger()).get();
}
I am getting an error that there is no reply :
org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 : "No reply received within timeout"
I don't know where it is going wrong, any solutions?
Solution The fact that i am using the wireTap() at the end of the flow makes the flow goes wrong, because there is no reply on default. so i had to add .bridge() to the flow. The flow should be as below :
@Bean
public IntegrationFlow flow() {
return IntegrationFlows.from(Http.inboundGateway("/foo")
.requestMapping(m -> m.methods(HttpMethod.POST)
.transform(Transformers.objectToString())
.enrichHeaders(h -> h.headerExpression())
.transform(new ObjectTransformation()).wireTap("subChannel").bridge()
.get();
}
check this post https://stackoverflow.com/questions/62673629/timeout-on-replychannel-when-wiretap-is-used#:~:text=The%20behavior%20is,more%20in%20docs