mule顺序流等待另一个流程

时间:2014-08-20 18:17:38

标签: mule

主流程:或流程A

<mule>
    <flow name="GetQBClassesFlow1" doc:name="GetQBClassesFlow1" processingStrategy="synchronous">
        <http:inbound-endpoint exchange-pattern="request-response" host="${hostname}" port="${port}" path="getClasses" doc:name="HTTP"/>
        <flow-ref name="Authenticate-QB" doc:name="Flow Reference"/>
        <logger message="=========Acc Token==========#[sessionVars['accessToken']]" level="INFO" doc:name="Logger"/>
        <flow-ref name="GetQBClassesFlow2" doc:name="Flow Reference"/>
    </flow>
    <flow name="GetQBClassesFlow2" doc:name="GetQBClassesFlow2" processingStrategy="synchronous">
        <logger message="=========Acc Token 2==========#[sessionVars['accessToken']]" level="INFO" doc:name="Logger"/>
    </flow>
</mule>

身份验证:或流程B

<mule ...>
    <quickbooks:config name="QBAuthenticate" consumerKey="${consumerKey}" consumerSecret="${consumerSecret}" doc:name="Quickbooks Online - Authenticate"/>
    <flow name="Authenticate-QB" doc:name="Authenticate-QB" processingStrategy="synchronous">
        <http:inbound-endpoint exchange-pattern="request-response" host="${hostname}" port="8989" doc:name="HTTP"/>
         <quickbooks:auth-user config-ref="Authenticate"
                    accessTokenUrl="https://oauth.intuit.com/oauth/v1/get_access_token"
                    authorizationUrl="https://appcenter.intuit.com/Connect/Begin"
                    callbackUrl="http://${hostname}:8989/getQBAccessToken"
                    requestTokenUrl="https://oauth.intuit.com/oauth/v1/get_request_token"
                    doc:name="Authenticate user" requestTokenId="tenantId"/>
    </flow>
    <flow name="qbAccessToken" doc:name="getAccessToken" processingStrategy="synchronous">
        <http:inbound-endpoint exchange-pattern="one-way" host="${hostname}" port="8989" path="getQBAccessToken" doc:name="Get Token"/>
        <logger message="=========GET QB Accounts ============" level="INFO" doc:name="Logger"/>
        <quickbooks:get-access-token config-ref="QBAuthenticate" doc:name="get access token"/>
        <logger message="=========realmId==============#[message.payload.realmId]" level="INFO" doc:name="Logger"/>
        <set-session-variable variableName="accessToken"
            value="#[message.payload.accessToken]" doc:name="Set accessToken" />
        <set-session-variable variableName="accessTokenSecret"
            value="#[message.payload.accessTokenSecret]" doc:name="Set accessTokenSecret" />
        <set-session-variable variableName="realmId"
            value="#[message.payload.realmId]" doc:name="Set realmId" />
    </flow>
</mule>

我有一个名为GetQBClassesFlow1(主流)的FLOW,它调用另一个流Authenticate-QB(上面的认证流程),即GetQBClassesFlow1调用Authenticate-QB,其中Authenticate-QB等待用户在登录页面上输入详细信息,但之前完成Authenticate-QB流程后,GetQBClassesFlow1继续(假设等待完成身份验证详细信息页面),这会导致问题。我想GetQBClassesFlow1应该等待流Authenticate-QB完成。我怎么处理这个?

输出:

INFO  2014-08-20 11:18:03,830 [[qbprojects].connector.http.mule.default.receiver.03] org.mule.api.processor.LoggerMessageProcessor: =========Acc Token==========null
INFO  2014-08-20 11:18:03,831 [[qbprojects].connector.http.mule.default.receiver.03] org.mule.api.processor.LoggerMessageProcessor: =========Acc Token 2==========null
INFO  2014-08-20 11:18:12,712 [[qbprojects].connector.http.mule.default.receiver.03] org.mule.api.processor.LoggerMessageProcessor: =========GET QB Accounts ============
INFO  2014-08-20 11:18:12,944 [[qbprojects].connector.http.mule.default.receiver.03] org.mule.api.processor.LoggerMessageProcessor: =========realmId==============1345020

1 个答案:

答案 0 :(得分:0)

Authenticate-QB流程旨在由最终用户通过HTTP调用,以便执行OAuth2舞蹈。

因此,您无法使用flow-ref调用它。验证部分是在你的流程正在进行的任何其他事件的带外完成的。