gpt4 book ai didi

java - 如何使用 quartz 每 2 分钟在 mule 中运行一次查询

转载 作者:行者123 更新时间:2023-11-30 11:15:30 25 4
gpt4 key购买 nike

我想每 2 分钟执行一次查询,但出现以下错误。

--------------------------------------------------------------------------------
Exception stack is:
1. No serializer found for class org.mule.transport.NullPayload and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (org.codehaus.jackson.map.JsonMappingException)
org.codehaus.jackson.map.ser.impl.UnknownSerializer:52 (null)
2. No serializer found for class org.mule.transport.NullPayload and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (org.codehaus.jackson.map.JsonMappingException) (org.mule.api.transformer.TransformerException)
org.mule.module.json.transformers.ObjectToJson:107 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.codehaus.jackson.map.JsonMappingException: No serializer found for class org.mule.transport.NullPayload and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) )
at org.codehaus.jackson.map.ser.impl.UnknownSerializer.failForEmpty(UnknownSerializer.java:52)
at org.codehaus.jackson.map.ser.impl.UnknownSerializer.serialize(UnknownSerializer.java:25)
at org.codehaus.jackson.map.ser.StdSerializerProvider._serializeValue(StdSerializerProvider.java:610)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

我的流程如下。

 <flow name="testdbFlow1" doc:name="testdbFlow1">

<quartz:inbound-endpoint responseTimeout="10000" doc:name="Quartz" jobName="CronJobSchedule" repeatInterval="0" cronExpression="0 0/2 * ? * MON-FRI" repeatCount="1">
<quartz:event-generator-job/>
</quartz:inbound-endpoint>
<jdbc-ee:outbound-endpoint queryKey="select_qry" queryTimeout="-1" connector-ref="Database" doc:name="Database"/>
<json:object-to-json-transformer doc:name="Object to JSON"/>
<echo-component doc:name="Echo"/>

</flow>

最佳答案

通过添加 quartz:payload 尝试以下操作:-

<flow name="testdbFlow1" doc:name="testdbFlow1">
<quartz:inbound-endpoint responseTimeout="10000" doc:name="Quartz" jobName="CronJobSchedule" repeatInterval="0" cronExpression="0 0/2 * ? * MON-FRI" repeatCount="1">
<quartz:event-generator-job>
<quartz:payload>quartzSchedular started</quartz:payload>
</quartz:event-generator-job>
</quartz:inbound-endpoint>
<jdbc-ee:outbound-endpoint queryKey="select_qry" queryTimeout="-1" connector-ref="Database" doc:name="Database"/>
<json:object-to-json-transformer doc:name="Object to JSON"/>
<echo-component doc:name="Echo"/>

</flow>

更新:-json:object-to-json-transformer 之后使用记录器,如下所示:-

<logger message="#[message.payload]" level="INFO" doc:name="Logger"/>

并删除 echo 组件 ...

并在 JDBC 组件中制作 exchange-pattern="request-response" 如下所示:-

<jdbc-ee:outbound-endpoint queryKey="select_qry" queryTimeout="-1"  connector-ref="Database" exchange-pattern="request-response" doc:name="Database"/>

关于java - 如何使用 quartz 每 2 分钟在 mule 中运行一次查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25382997/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com