私は以下のケーススタディに取り組んでいます。Spring IntegrationでQueueChannelを使用する
- 参照IDを受け入れるレストサービスを作成します。
- 「参照ID」を使用して、データベースからデータ(CLOB)を取得します。
- さらに処理するために、データ(CLOB)をチャネル(キュー)に入れます。
- JSON形式{「ステータス」:真、「メッセージ」:「受信」}で応答データと残りのクライアントに返信
私は休憩サービスが作成されており、文献IDを使用してデータを取得していますデータベースから、私はチャネル(キュー)にメッセージを入れた後、残りのクライアントに応答を返すことができません。残りのクライアントが受信した 出力は、次のとおりです。返事は基本的に私は、チャネル(キュー)にプッシュされたリクエスト・スレッドがデータ(CLOB)の直後に返すことにしたいタイムアウト
内に受信されません。
以下はその構成です。
<int:channel id="responseChannel"/>
<int:channel id="initCalculation">
<int:queue/>
</int:channel>
<!-- GET -->
<int-http:inbound-gateway
request-channel="httpGetChannel"
reply-channel="responseChannel"
supported-methods="GET"
path="/init/{refId}"
payload-expression="#pathVariables.refId">
<int-http:request-mapping produces="application/json"/>
</int-http:inbound-gateway>
<int:chain input-channel="httpGetChannel" output-channel="initCalculation">
<int-jdbc:stored-proc-outbound-gateway
id="outbound-gateway-storedproc-get-forma" data-source="dataSource"
is-function="false"
stored-procedure-name="XX_EMPROC.GET_FRMA"
ignore-column-meta-data="true"
expect-single-result="true">
<int-jdbc:sql-parameter-definition name="V_REF_ID" direction="IN" />
<int-jdbc:sql-parameter-definition name="V_FRMA" direction="OUT" type="#{T(oracle.jdbc.OracleTypes).CLOB}"/>
<int-jdbc:parameter name="V_REF_ID" expression="payload" />
</int-jdbc:stored-proc-outbound-gateway>
<!- Convert to JSON Format -->
<int:service-activator ref="brInitGateway" method="getResponse"/>
</int:chain>
<int:outbound-channel-adapter channel="initCalculation" ref="brInitGateway" method="process"/>
上記の修正が必要です。
おかげ
応答を送信しない場合は、ゲートウェイの代わりにインバウンドチャネルアダプタを使用することもできます。 CLOBをキュー・チャネルに渡すと、デフォルトで200OKが送信されます。 –
@GaryRussell - 提案をありがとう。それを覚えておいてください。 –
@Artem Bilan - あなたのソリューションに感謝します。私のユースケースでは完璧に機能しました。 –