ITeye博客

mule & seda 学习二

hamlzf · 2011-11-03 09:11 · SOA · 企业架构 · SOA · mule · Markdown

mule的jdbc,配置seda以及vm的初步认识 java类 package com.zxgllhh.jdbc; import java.util.Map; public class NumberServiceComponent { public NumberServiceComponent(){ } public Object process(Object vm) throws Exception{ Thread.sleep(5000l); System.out.println(); Map map = (Map)vm; System.out.println("NumberServiceComponent, jdbc message is "+map.get("red_one")); System.out.println("NumberServiceComponent, this hashcode is "+this.hashCode()); return " ..... return NumberServiceComponent is : "+vm +" ....."; } } 配置文件 this is a description, to be expert or not to be is not a question. To invoke the EchoUMO hit the following URL - http://localhost:65082/services/EchoServiceUMO/echo/requestResultByzxg/zxg To view the WSDL for the EchoUMO service go to - http://localhost:65082/services/EchoServiceUMO?wsdl spring配置文件 ssq ssq 运行类 package com.zxgllhh.run; import org.mule.api.MuleContext; import org.mule.api.context.MuleContextFactory; import org.mule.config.spring.SpringXmlConfigurationBuilder; import org.mule.context.DefaultMuleContextFactory; public class EagleMuleMain { public static void main(String[] args) throws Exception{ try { String configFile = "com/zxgllhh/run/mule-config.xml"; String[] configFileArr = new String[] { configFile }; MuleContextFactory muleContextFactory = new DefaultMuleContextFactory(); MuleContext context = muleContextFactory .createMuleContext(new SpringXmlConfigurationBuilder( configFileArr)); context.start(); } catch (Exception t) { t.printStackTrace(); } } } 一个名为jdbcService的service组件从selectNumber得到数据(这个数据为map格式的colum/value)处理过后,还可以把消息发送到 vm://orders上等待下一步的执行。这就是分段式事件驱动架构。 package com.zxgllhh.jdbc; import java.util.Map; public class NumberServiceComponent { public NumberServiceComponent(){ } public Object process(Object vm) throws Exception{ Thread.sleep(5000l); System.out.println(); Map map = (Map)vm; System.out.println("NumberServiceComponent, jdbc message is "+map.get("red_one")); System.out.println("NumberServiceComponent, this hashcode is "+this.hashCode()); return map; } } package com.zxgllhh.vm; public class VMComponent { public VMComponent(){ System.out.println("init VMComponent..."); } public Object process(Object vm){ System.out.println("VMComponent, vm message is "+vm); System.out.println("VMComponent, this hashcode is "+this.hashCode()); return "vm : "+vm; } }

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。