バネの統合を使用して、キューから読み取り、http:outbound-gatewayを使用してRESTサービスを呼び出しています。コードは正常に動作します。しかし、私はログを関連づけて、特定の要求キーフィールドのために応答を受け取るようにしたい。それ以外の場合は、キューに何千ものメッセージが流れているときに、応答を受け取った要求を特定することは非常に困難です。 { "ID": "123"、 "ステータス": "A"}を次のようにhttp:outbound-gatewayでリクエストデータをレスポンスデータとともに記録する方法
サービス呼び出しのための私のJSON要求がある
次のようにサービス呼び出しからの私のJSON応答は次のとおりです。 { "transactionStatus": "Success"} "ID:123"にtransactionStatusが "Success"と返されるようにログを記録します。 私はどのようにこれを達成することができますコードで私を助けてください。詳細が必要な場合はお知らせください。 ありがとうございます。
<int:object-to-json-transformer input-channel = "gcmRequestChannel" output-channel="RESTSrvcChannel"></int:object-to-json-transformer>
<int:header-enricher id = "restenricher" input-channel = "RESTSrvcChannel" output-channel = "RESTSrvcChannel2">
<int:header name="contentType" value="application/json"/>
<int:header name="SPApikey" value="${throttler.SPApikey}" />
</int:header-enricher>
<http:outbound-gateway id="gcmrestHttpOutboundGateway" request-channel="RESTSrvcChannel2" reply-channel="nullChannel"
extract-request-payload="true"
url="${throttler.url}"
header-mapper="headerMapper"
http-method="POST"
expected-response-type="java.lang.String"
>
</http:outbound-gateway>
<beans:bean id="headerMapper"
class="org.springframework.integration.http.support.DefaultHttpHeaderMapper">
<beans:property name="inboundHeaderNames" value="*" />
<beans:property name="outboundHeaderNames" value="HTTP_REQUEST_HEADERS,SPApikey" />
<beans:property name="userDefinedHeaderPrefix" value="" />
</beans:bean>