Может ли кто-нибудь помочь, как вернуть null вместо возврата исключения в качестве вывода json.
<?xml version="1.0" encoding="UTF-8"?> <mule xmlns:validation="http://www.mulesoft.org/schema/mule/validation" xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd http://www.mulesoft.org/schema/mule/validation http://www.mulesoft.org/schema/mule/validation/current/mule-validation.xsd"> <http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="9097" doc:name="HTTP Listener Configuration"/> <validation:config name="Validation_Configuration" doc:name="Validation Configuration"/> <flow name="testFlow"> <http:listener config-ref="HTTP_Listener_Configuration" path="/test" allowedMethods="GET" doc:name="HTTP"/> <db:select config-ref="Generic_Database_Configuration" doc:name="Database"> <db:dynamic-query><![CDATA[SELECT * FROM SALESIT_DB.SALESIT_SC3VIS_BR.abcd trx where trx.employee_id= '1232' and trx.so_number='abc']]></db:dynamic-query> </db:select> <logger message="#[payload]" level="INFO" doc:name="Logger"/> <dw:transform-message doc:name="Transform Message" metadata:id="3581fe3a-a6f9-4071-b861-fcf16396358a"> <dw:input-payload mimeType="application/java"/> <dw:set-payload><![CDATA[ %dw 1.0 %output application/json --- payload filter (($.payload != 0)) ]]></dw:set-payload> </dw:transform-message> </flow> </mule>
исключение Numeri c значение 'ab c' не распознается (net .snowflake.client.jdb c .SnowflakeSQLException).
Есть ли способ, которым мы можем напечатать null в качестве выходной полезной нагрузки вместо вывода исключения.
Может кто поможет.
Спасибо, Nikhil
Извлеките db: select в отдельный поток, а затем вызовите его, используя ссылку на поток.
Определите catch-exception-strategy в извлеченном потоке и внутри него setPayload равным null.
catch-exception-strategy