自动启动M子流 [英] auto-starting Mule flow

查看:94
本文介绍了自动启动M子流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试这种方法来自动启动M子流

I'm trying this approach to autostart a Mule flow

使用groovy以编程方式开始m流

,它不会启动流程.这是在带有3.4.0 CE的Mule Studio中运行的非常简单的测试

and it does not start the flow. Here's a very simple test run in Mule Studio with the 3.4.0 CE

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting"     
xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="CE-3.4.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans     
http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd">

<flow name="auto2Flow1" doc:name="auto2Flow1">
    <scripting:component doc:name="Groovy">
        <scripting:script engine="Groovy">
             muleContext.registry.lookupFlowConstruct('flow1').start()
        </scripting:script>
    </scripting:component>
</flow>

<flow name="flow1" doc:name="flow1">
    <logger level="INFO" doc:name="Logger" message="hello"/>
</flow>

</mule>

我也没有运气尝试过

<expression-component>
   app.registry.flow1.start();
</expression-component>

我假设flow1已自动注册,但不确定.

I'm assuming flow1 is automatically registered but not sure.

推荐答案

我认为您要执行的操作不是启动,而是向您发送事件,您会看到logger写出hello.

I think that what you are trying to do is not starting the flow but instead send an event to it so, in your case, you'll see the logger write out hello.

为此,请使用:

app.registry.flow1.process(event);

'event'是DefaultMuleEvent的实例( javadoc ).

with 'event' being an instance of DefaultMuleEvent (javadoc).

这篇关于自动启动M子流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆