用过mule-esb的请进来一下 (via TranXcode)
mule-esb中的file构建可以设置文件夹路经path,当mule启动后会自动地会对该path路径进行监控。
不知道各位有没有用过这个file构件,如果用过的话,有没有实现过通过程序自动更改path路经,并且立即见效。因为我现在能想到的方法就是更改xml文件,然后重新启动mule服务,这样更新一次path路径生效速度将很慢。不知道有哪位大侠对mule进行研究过,是否知道mule里面提供没提供更改file构件中path路径中的方法。
感激不尽。
<flow name="File1"> <file:inbound-endpoint connector-ref="input" path="C:\file"> <file:filename-wildcard-filter pattern="*.*" /> </file:inbound-endpoint> <log-component /> <component> <singleton-object class="com.tt.MessageEngineFileClient" /> </component> </flow>
private static MuleContext muleContext;private static ApplicationContext context;/** * 停止mule上下文服务 * * @throws MuleException */private static void stopMuleContext() throws MuleException { if (muleContext != null) { muleContext.stop(); muleContext = null; }}/** * 启动mule上下文服务 * * @throws MuleException */private static void startMuleContext() throws MuleException { SpringXmlConfigurationBuilder builder = new SpringXmlConfigurationBuilder( "mule-config.xml"); builder.setParentContext(context); muleContext = new DefaultMuleContextFactory() .createMuleContext(builder); muleContext.start();}/** * 重新启动mule服务 * * @param sendDir */public static void restartMuleService(String sendDir) { try { MuleLoader.stopMuleContext(); logger.info("ESB关闭成功"); } catch (MuleException e) { e.printStackTrace(); logger.error("ESB关闭失败"); } try { JdomForXml.modifyMuleConfigXml(sendDir); } catch (Exception e1) { e1.printStackTrace(); logger.error("'mule-config.xml'配置文件中File构件的path路径更改异常"); } try { MuleLoader.startMuleContext(); logger.info("ESB重启成功"); } catch (MuleException e) { e.printStackTrace(); logger.error("ESB重启失败"); }}
[解决办法]
大伙啊,给点热情。我也遇到同样的问题了