私は、レコードをデータベースに挿入するために、ワークフローを作成しています。すでに存在し、HTTPステータス(409-Conflict)とバックをクライアントに送信します。Mule Exception strategyの定義:要素 'choice-exception-strategy'で始まる無効な内容が見つかりました
<when expression="#[message.inboundProperties['http.method'] == 'POST']">
<json:json-to-object-transformer returnClass="java.lang.Object" doc:name="JSON to Object" />
<set-variable variableName="id" value="#[message.payload.id]" doc:name="Save brandId"/>
<json:object-to-json-transformer doc:name="Object to JSON"/>
<db:insert config-ref="Postgres" doc:name="Configstore">
<db:parameterized-query><![CDATA[INSERT INTO messages("id", "data") VALUES (#[flowVars['id']], CAST(#[message.payload] as json))]]> </db:parameterized-query>
</db:insert>
<logger message="REST Response = #[message.payload]" level="INFO" doc:name="LOG Rest Response"></logger>
<choice-exception-strategy name="Global_Choice_Exception_Strategy" doc:name="Global Choice Exception Strategy">
<catch-exception-strategy doc:name="Catch_Exception_Strategy" when="#[exception.causedBy(org.postgresql.util.PSQLException)]">
<set-payload value="The request cannot be processed, the error is #[exception.getExceptionPayload()]"/>
<set-property propertyName="http.status" value="404"/>
<http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" method="POST" doc:name="HTTP"/>
</catch-exception-strategy>
</choice-exception-strategy>
</when>
起動が繰り返し失敗し、次のエラーがログに記録されます。
cvc-complex-type.2.4.a:要素 'choice-exception-strategy'で始まる無効なコンテンツが見つかりました。 '{"http://www.mulesoft.org/schema/mule/core":抽象メッセージプロセッサ、 "http://www.mulesoft.org/schema/mule/core":抽象アウトバウンドエンドポイント、 "http://www.mulesoft.org/schema/mule/core":抽象混合コンテンツメッセージプロセッサ}のいずれかが必要です。 [??:]
代わりの選択肢-例外戦略とキャッチ例外戦略の両方について報告このエラーorg.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(不明なソース)〜で 。ここで何が無効か、カスタムメッセージプロセッサまたはアウトバウンドエンドポイントを定義する必要があるかどうかは不明です。私はMuleを使用しています。EE-3.8.0
フローレベルでなければなりません。 ' 'のように終わる前に定義してください。 -payload value = "リクエストは処理できません。エラーは#[exception.getExceptionPayload()]です。doc:name ="ペイロードの設定 "/> ..... catch-exception-strategy> です。 Intellji GUIを使用している場合、GUIはありません。 –
star