im currently getting this error :
DestinationResolutionException:
no output-channel or replyChannel header available .
I have a file gateway that is injected in a controller
@MessagingGateway
public interface FileGateway {
@Gateway(requestChannel = "router.input", replyChannel = "output")
FileRequestResponse requestFile(FileRequestRequest fileFetchRequest);
}
and a router that send messages to respective channels
@Bean
IntegrationFlow routeFileRequest() {
return IntegrationFlows.from("router.input")
.<FileRequestRequest, FileType>route(m -> m.getParameters().getFileType(), m -> m
.channelMapping(FileType.CONTRACT, "contract.transform")
.channelMapping(FileType.INVOICE, "invoice.tranform"))
// .channelMapping(FileType.USAGE, "usageChannel"))
.get();
}
Here my transformer bean , converts message to string and sends to contract.input channel , i can see in my logs that message arrives contract,input channel , however after response in handler method i get:
org.springframework.messaging.core.DestinationResolutionException:
no output-channel or replyChannel header available.
Transformer:
@Transformer(inputChannel = "contract.transform", outputChannel = "contract.input")
public Message<String> transformContractMessage(Message<FileRequestRequest> request) {
/**
*
* @param request
* @return contractId
*/
FileRequestRequest frr = request.getPayload();
return MessageBuilder.
withPayload(request.
getPayload().getContractId()).
setHeader("fileType", "CONTRACT").build();
}
Below is the service activator to send message back to router.output , however i encounter that exception above .
@ServiceActivator(inputChannel = "contract.input" ,outputChannel = "output")
public FileRequestResponse res(Message<String> message){
log.info(" Retrieving File With Contract ID {} ",message.getPayload());
ContractRsp contractResponse = contractFetchService.retrieveContract(message.getPayload());
log.info(" Contract File Received {} ",contractResponse);
return FileRequestResponse.builder().build();
}
@Bean
public DirectChannel output(){
DirectChannel channel = new DirectChannel();
return channel;
}
My aim here is to get message back to FileGateway interface after response .