解決策が得られないというアプリケーションにエラーが表示されます。 アプリケーションはREST/JSONを要求し、別のアプリケーションとの通信を試みます。非同期に各要求を呼び出すポーラーがあります。 リクエストが常に「no output-channelまたはreplyChannel header available」というエラーをディスパッチすると、errorChannelハンドルにリダイレクトされます。チャネル上HttpRequestExecutingMessageHandler:出力チャネルまたは返信チャネルヘッダーがありません
postSend(真=送信) 'errorChannel'、メッセージ:
... @Bean(name = PollerMetadata.DEFAULT_POLLER) public PollerMetadata poller() { return Pollers .fixedRate(NumberUtils.createLong(QUEUE_RATE)) .get(); } @Bean public MessageChannel errorChannel() { return MessageChannels.direct().get(); } @MessagingGateway public static interface HttpService { @Gateway(requestChannel = "service.input") void send(@Payload String body, @Headers MultiValueMap<String, String> headers); } public MessageHandler httpOutboundAdapter(){ HttpRequestExecutingMessageHandler handler = Http.outboundGateway(URI, restTemplate) .expectedResponseType(String.class) .httpMethod(HttpMethod.POST) .mappedRequestHeaders("Authorization","Accept","Content-Type", "X-User-Email","X-User-Token") .get(); return handler; } @Bean public FileWritingMessageHandler fileOutboundAdapter(){ FileWritingMessageHandler fwmhs = Files .outboundAdapter(new File("logs/errors")) .autoCreateDirectory(true) .get(); return fwmhs; } @Bean public IntegrationFlow send(){ return IntegrationFlows.from("service.input") .log(Level.DEBUG, "trace.http", "'Request.\n'"+ ".concat('Headers : ').concat(headers.toString()).concat('\n')"+ ".concat('Payload : ').concat(payload.toString())" ) .channel(MessageChannels.queue()) .handle(this.httpOutboundAdapter() .transform(Transformers.toJson()) .log(Level.DEBUG, "trace.http", "'Response.\n'"+ ".concat('Headers : ').concat(headers.toString()).concat('\n')"+ ".concat('Payload : ').concat(payload.toString())" ) .get(); } @Bean public IntegrationFlow errorFlow(){ return IntegrationFlows.from(errorChannel()) .log(Level.DEBUG,"trace.http", "'Ocurred an error in httpResponse :'.concat(payload.message)") .transform("payload.failedMessage") .handle((p,h) -> MessageBuilder.withPayload(new GenericMessage<>(p,h))) .transform(Transformers.toJson()) .enrichHeaders(c -> c.headerExpression(FileHeaders.FILENAME, "'emailErrors-'.concat(headers.getTimestamp()).concat('.json')")) .handle(fileOutboundAdapter()) .get(); }
ログプリントはにErrorMessage [ペイロード= org.springframework.messaging.MessagingException:ディスパッチャがメッセージを届けることができませんでした。なし出力チャネル又はreplyChannelヘッダ、ヘッダ= {ID = 826074c0-d1c6-4ecf-44f0-6da697b29f9c、タイムスタンプ= 1484650523378}]
更新:ネストされた例外はあるorg.springframework.messaging.core.DestinationResolutionExceptionゲイリー・ラッセルの暗示後
...
@Bean
public IntegrationFlow send(){
return IntegrationFlows.from("service.input")
.log(Level.DEBUG, "trace.http",
"'Request.\n'"+
".concat('Headers : ').concat(headers.toString()).concat('\n')"+
".concat('Payload : ').concat(payload.toString())"
)
.channel(MessageChannels.queue())
.handle(this.httpOutboundAdapter()
.transform(Transformers.toJson())
.log(Level.DEBUG, "trace.http",
"'Response.\n'"+
".concat('Headers : ').concat(headers.toString()).concat('\n')"+
".concat('Payload : ').concat(payload.toString())"
)
.channel("nullChanel")
.get();
}
ログ
2017-01-17 13:58:31.929 DEBUG 19702 --- [ask-scheduler-9] osintegration.channel.DirectChannel:チャネル 'send.channel#3'でpreSend、メッセージ:GenericMessage [payload = $ PAYLOAD_JSON、 headers = $ HEADERS] 2017-01-17 13:58:31.930 DEBUG 19702 --- [ask-scheduler-9] ositMessageTransformingHandler:org.springframework.integration.transformer.MessageTransformingHandler#0受信メッセージ:GenericMessage [payload = $ PAYLOAD_JSON、headers = $ HEADERS] 2017-01-17 13:58:31.932 DEBUG 19702 --- [ask-scheduler-9] osintegration.channel.DirectChannel:チャネル 'send.channel#5'のpreSend、メッセージ: GenericMessage [payload = $ PAYLOAD_JSON、headers = $ HEADERS] 2017-01-17 13:58:31.932 DEBUG 19702 --- [ask-scheduler-9] osintegration.handler.LoggingHandler:org.springframework.integration.handler。 LoggingHandler#1はメッセージを受信しました:GenericMessage GenericMessage [payload = $ PAYLOAD_JSON、headers = $ HEADE [ask-scheduler-9] osintegration.handler.BridgeHandler:org.springframework.integration.handler.BridgeHandler#2受信メッセージ:GenericMessage [payload = $ PAYLOAD_JSON、headers = $ HEADERS] 2017-01-17 13:58:31.943 DEBUG 19702 --- [ask-scheduler-9] osintegration.channel.DirectChannel:チャネル 'nullChanel'でpreSend、メッセージ:GenericMessage [payload = askDateChannel: 'errorChannel'チャネルのpreSend、メッセージ:ErrorMessage [$ ask_scripter-9]、$ headers = $ headers = $ PAYLOAD_JSON、ヘッダー= $ HEADERS] 2017-01-17 13:58:31.944 DEBUG 19702 --- [ask-scheduler-9] osintegration.channel.DirectChannel: payload = org.springframework.messaging.MessageDeliveryException:ディスパッチャに 'application:29891.nullChanel'チャネルのサブスクライバがありません。ネストされた例外はorg.springframework.integration.MessageDispatchingExceptionです:Dispatcherにはサブスクライバがありません。ヘッダー= {id = fe0672cd-b9e4-9d43-2c5a-3d2d0a1c5493、タイムスタンプ= 1484668711944} 2017-01-17 13:58:31.945 DEBUG 19702 - - [ask-scheduler-9] osintegration.handler.LoggingHandler:org.springframework.integration.handler.LoggingHandler#2受信メッセージ:ErrorMessage [payload = org.springframework.messaging.MessageDeliveryException:Dispatcherにチャネル 'applicationのサブスクライバがありません:29891.nullChanel '.;ネストされた例外はorg.springframework.integration.MessageDispatchingExceptionです:Dispatcherにはサブスクライバがありませんヘッダー= {id = fe0672cd-b9e4-9d43-2c5a-3d2d0a1c5493、タイムスタンプ= 1484668711944} 2017-01-17 13:58:31.949 DEBUG 19702 - - [ask-scheduler-9] ositMessageTransformingHandler:org.springframework.integration.transformer.MessageTransformingHandler#1受信メッセージ:ErrorMessage [payload = org.springframework.messaging。MessageDeliveryException:Dispatcherに 'application:29891.nullChanel'チャネルのサブスクライバーがありません。ネストされた例外はorg.springframework.integration.MessageDispatchingExceptionある:58:31.951 DEBUG Dispatcherはない加入者、ヘッダー= {ID = fe0672cd-b9e4-9d43-2c5a-3d2d0a1c5493、タイムスタンプ= 1484668711944}] 2017年1月17日13を有しています19702 --- [尋ねる-スケジューラ-9]をosintegration.channel.DirectChannel:Presendのチャンネルの 'errorFlow.channel#1'、メッセージ:GenericMessage [ペイロード= $ PAYLOAD_JSON、ヘッダ= $ HEADERS]
Iペイロードとヘッダーを$ PAYLOAD_JSONと$ HEADERSに置き換えてログを減らしました。
回答ありがとうございます。私はあなたが言ったようにしようとしましたが、同じエラーをディスパッチしましたが、現在は "nullChannel"という名前を付けました。
*チャンネル 'errorChannel'のpreSend、メッセージ:ErrorMessage [payload = org.springframework.messaging.MessageDeliveryExceptionDispatcherにはチャンネル 'application:29891.nullChanel'のサブスクライバがありません。入れ子にされた例外はorg.springframework.integration.MessageDispatchingExceptionです:Dispatcherにはサブスクライバがありません。ヘッダー= {id = 6f28519a-d7d3-4a84-2b76-960d340ec4c2、タイムスタンプ= 1484662227466} * –
私は同様のフローを問題なくテストしました。あなたの新しい構成を示す質問。 'org.springframework.integration'のDEBUGロギングをオンにし、最後のいくつかのログを(コメントではなくあなたの質問に)表示します。また、完全なスタックトレースも表示します。 –
私は質問を更新しました。 –