ule子,如何在java类中触发流 [英] mule,How to trigger a flow in java class

查看:85
本文介绍了ule子,如何在java类中触发流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个Java类来捕获systemException(数据库连接失败), 在课堂上,我尝试重新连接到数据库10次. 如果连接成功,我想重新启动正常流程. 那么如何重新启动此类中的流程? 有什么建议吗?非常感谢.

I had created a java class to catch the systemException(DB connection Fail), In the class I tried to reconnect to DB for 10 times. If connect success,I want to restart the normal flow. So how can I restart the flow in this class?? Any advise? Thanks a lot.

推荐答案

您可以通过使数据流通过start子注册表并分别调用start和stop方法来停止和启动数据流.例如:

You can stop and start the flows by getting them through the mule registry and invoking the start and stop method respectively. An example of this would be :

    Flow myFlow = (Flow) eventContext.getMuleContext().getRegistry().get("FlowName");
    myFlow.stop();
    myFlow.start();

但是我认为这不是理想的方法,而且我认为这不会解决您的问题.

But I don't think this is the ideal approach and further more I don't think that this would resolve your issue.

给我的印象是您使用的是旧的" JDBC连接器.该连接器具有重新连接策略,可以为您执行此操作.请参考 http://www.mulesoft.org/documentation/display/当前/配置+重新连接+策略以获取更多信息.

I am under the impression you are using the "old" JDBC connector. This connector has a reconnection policy that would do this for you. please refer to http://www.mulesoft.org/documentation/display/current/Configuring+Reconnection+Strategies for further information.

这篇关于ule子,如何在java类中触发流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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