在此之前,我问了一个问题。我的服务配置是:
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="UnpayBilling_Task"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<class name="com.coship.mediator.UnpayBillingMediator"></class>
<log level="full" />
</inSequence>
<outSequence>
<log level="full" />
<send />
</outSequence>
<endpoint>
<address uri="http://172.21.13.153:18080/aaa/services/receiveMsg" />
</endpoint>
</target>
</proxy>我写了一个扩展中介器UnpayBillingMediator处理文件。该类返回文件名并向服务http://172.21.13.153:18080/aaa/services/receiveMsg发送请求。该服务没有输入消息。我要每天13:30开始服务。我尝试添加新的计划任务。但是soapAction:urn:mediate,to:http://localhost:8280/services/UnpayBilling?wsdl, Cron: 30 13 * * *.不能工作吗?谁能告诉我如何设置这个计划任务?
SimpleQuartz Server name not in pinned servers list. Not starting Task我也不知道如何设置“固定服务器”。
发布于 2012-05-24 17:31:46
让我解释一下WSO2企业服务总线中的默认消息注入器任务是如何工作的。
它基本上创建具有给定属性(例如:消息有效负载、收件人地址等)的消息,并以配置的间隔将其注入到主序列中。
因此,在您的示例中,您必须更改主序列,使其能够过滤带有给定To地址或特定消息体的消息,并将其转发。
要做的最简单的事情就是更改WSO2ESB主序列中的默认筛选器,以便它将筛选您的收件人地址并将其发送到后端服务。
例如:将过滤器更改为:
<filter xmlns:ns="http://org.apache.synapse/xsd
xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
xmlns:ns3="http://org.apache.synapse/xsd"
source="get-property('To')"
regex="http://localhost:8280/services/UnpayBilling.*" >
...发布于 2012-05-24 22:52:54
请查看以下ESB配置
它有一个名为Test的代理和一个名为MyTask的任务,当MyTask将消息注入主序列时,我们过滤" to“属性,如果它是我们从任务中设置的值,则将其发送到代理服务。
配置:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
<registry provider="org.wso2.carbon.mediation.registry.WSO2Registry">
<parameter name="cachableDuration">15000</parameter>
</registry>
<proxy name="Test" transports="https http" startOnLoad="true" trace="disable">
<target>
<inSequence>
<log level="full">
<property name="IN" value="IN"/>
</log>
<drop/>
</inSequence>
</target>
</proxy>
<sequence name="fault">
<log level="full">
<property name="MESSAGE" value="Executing default 'fault' sequence"/>
<property xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:ns="http://org.apache.synapse/xsd" xmlns:ns3="http://org.apache.synapse/xsd" name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
<property xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:ns="http://org.apache.synapse/xsd" xmlns:ns3="http://org.apache.synapse/xsd" name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
</log>
<drop/>
</sequence>
<sequence name="main">
<in>
<filter xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:ns="http://org.apache.synapse/xsd" xmlns:ns3="http://org.apache.synapse/xsd" source="get-property('To')" regex="http://localhost:8280/services/Test">
<then>
<send>
<endpoint>
<address uri="http://localhost:8280/services/Test"/>
</endpoint>
</send>
</then>
<else/>
</filter>
</in>
<out>
<drop/>
</out>
<description>The main sequence for the message mediation</description>
</sequence>
<task name="MyTask" class="org.apache.synapse.startup.tasks.MessageInjector" group="synapse.simple.quartz">
<trigger count="1" interval="4"/>
<property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="to" value="http://localhost:8280/services/Test"/>
<property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="message">
<msg xmlns="">FROM_TASK</msg>
</property>
</task>
</definitions>发布于 2012-05-26 12:17:51
您的cron表达式中有一个问题。请参考http://www.quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger
https://stackoverflow.com/questions/10723271
复制相似问题