2017-01-24 15 views
1

Spring Integration HTTPアウトバウンドゲートウェイのjava dsl設定を使用しようとしています。私は外部レストサービスに接続することができます。しかし、私は、応答テーブルに応答のペイロード情報&をインターセプトしたいと思います。Spring Integration HTTPアウトバウンドゲートウェイjava dsl with ChannelInterceptorAdapter

Springの統合XML設定により、私は達成することができます。

<int:channel id="channel.ext.request"> 
    <int:interceptors> 
     <ref bean="customInterceptor" /> 
    </int:interceptors> 
</int:channel> 

customIntercepterがChannelInterceptorAdapterを拡張しています。ここではpostSendメソッドをオーバーライドし、dbテーブルにチャンネル情報を保持しています。

public Message<?> postSend(Message<?> message, MessageChannel channel) { 
     return message; 
} 

これは期待どおりです。

java dslから応答チャネル情報&を傍受したいと思います。 ソースを取得できませんでした。ここで私のJava DSL設定です。

@Bean 
public IntegrationFlow httpOut() { 
     logger.info("IntegrationFlow enabled"); 

     return IntegrationFlows.from("channel.ext.request") 
       .enrichHeaders(getHeaders()) 
       .handle(Http.outboundGateway("http://hostname/rest/invoke").charset("UTF-8") 
         .httpMethod(HttpMethod.POST).requestFactory(requestFactory()).expectedResponseType(String.class)) 
       .channel("channel.ext.response").get(); 
} 

お勧めします。

答えて

1
.channel(MessageChannels.direct("channel.ext.request").interceptor(myInterceptor())) 
.handle(...) 
.channel(MessageChannels.direct("channel.ext.response").interceptor(myInterceptor())) 
+0

ありがとう、ゲイリー、それは私の問題を解決しました。 –

関連する問題