1

在此之前,我问了一个问题。我的服务配置是:

<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

我也不知道如何设置“固定服务器”。

4

3 回答 3

1

让我解释一下默认消息注入器任务在 WSO2 ESB 中是如何工作的。

它基本上创建具有给定属性的消息(例如:消息有效负载,地址等),并以配置的间隔将其注入主序列。

因此,在您的情况下,您将不得不更改主序列,以便过滤带有给定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-24T09:31:46.040 回答
1

请看下面的 ESB 配置

其中有一个名为 Test 的代理和一个名为 MyTask 的任务,当 MyTask 将消息注入主序列时,我们过滤“To”属性,如果它是我们从 Task 设置的值,那么我们将其发送到代理服务。

配置:

<?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-24T14:52:54.263 回答
1

您的 cron 表达式存在问题。请参考http://www.quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger

于 2012-05-26T04:17:50.767 回答