【问题标题】:WSO2 good practice with many service calls in a sequenceWSO2 良好实践,按顺序进行许多服务调用
【发布时间】:2014-02-18 12:25:53
【问题描述】:

我正在处理需要执行以下任务的预定序列:

call GetNew data service getting possible new xml data
if xml exists
    with the xml data, get the ID and save it into a property
    call UpdateStatus data service with the parameters ID and PROCESSING
    call the ProcessOrder service passing the xml data
    if the return is success
        call the external SetStatus service with SUCCESS
    otherwise
        call the external SetStatus service with ERROR 
    call UpdateStatus data service again with the parameters ID and PROCESSING
otherwise
    do nothing

为此,我构建了以下序列:

payload -- to build a GetNew request
callout -- to call the GetNew data service
property -- to save the ID from the possible new message
filter -- verify if the ID property exists
    then
        clone
            payload -- to build a UpdateStatus PROCESSING request
            callout -- call the UpdateStatus
        xslt -- transform the XML from GetNew to the ProcessOrder
        in
            send -- to the ProcessOrder endpoint
        out
            property -- save the status of the ProcessOrder response
            payload -- to build the SetStatus request
            callout -- call the external SetStatus service with the status
        payload -- to build a UpdateStatus PROCESSED request
        callout -- call the UpdateStatus
    else
        drop

我想知道这是否是一种好的做法,或者我是否应该将其拆分为多个序列,或者通过发送替换标注,以及使用这种方法处理 SoapFaults 的最佳方法是什么。

提前致谢。

【问题讨论】:

    标签: wso2 soa wso2esb synapse


    【解决方案1】:

    在设计决策中分解为多个序列。一般来说,序列更像是一个类。如果特定序列执行特定任务,那么它在其他场景中也将具有凝聚力和高度可重用性。所以最好根据通过顺序执行的逻辑任务来休息。

    使用 callout 或 send mediator 取决于您尝试实现的用例。 Precisely send mediator 与 callout 的不同之处在于调用是异步的。所以 callout mediator 会进行阻塞调用,但如果您需要来自服务的响应以继续执行序列,这将很有用。 您可以在以下链接中获取有关这些调解器的更多详细信息。 http://docs.wso2.org/display/ESB480/Mediators

    对于代理服务和序列,您可以定义故障序列来处理故障场景。有关错误处理的更多信息,您可以关注http://docs.wso2.org/display/ESB480/Error+Handling

    【讨论】:

      猜你喜欢
      • 2020-08-17
      • 2012-01-10
      • 2012-09-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-25
      • 1970-01-01
      • 2014-07-14
      相关资源
      最近更新 更多