现在的位置: 首页 > 综合 > 正文

Mule+Spring+jbpm

2013年06月12日 ⁄ 综合 ⁄ 共 2633字 ⁄ 字号 评论关闭

法一:完全在spring.xml里面配置mule的所有内容

该方法的缺点的是配置umo比mule语法更加繁琐

法二:两个配置分件都用,不过mule里面需要加入一些mule-spring的标记
其本质是将mule.xml转换成法一中的spring.xml

该方法比较适合在现有的spring应用中,加入mule

 

法三:在mule server的container内启动spring,各自用自己的配置文件格式,适用于以mule server为主,spring为辅的应用

假设有两个bean,restaurantWaiter和kitchenService,前者作为UMO来接收消息,然后调用service
1 spring-context.xml



2 mule.xml
inboundEndpoint="vm://order.queue"
implementation="restaurantWaiter">

为了让Mule能够识别restaurantWaiter,需要配置

....

....

 

 

Spring+jbpm+mule 三者是可以完美结合的

 

   
   
        org.hsqldb.jdbcDriver
        jdbc:hsqldb:mem:.;sql.enforce_strict_size=true
        sa
       
   

   
   
   
       
           
       

       
            classpath*:/org/jbpm/**/*.hbm.xml
       

       
           
       

       
                            org.hibernate.dialect.HSQLDialect                1                3                false                true 1, false 0                0               
                update           
       

   

   
   
        string_max
        org.jbpm.db.hibernate.StringMax
   

   
   
       
           
       

       
            jbpm.cfg.xml
       

       
           
               
                   
                        loan-broker-process.xml
                   

               

           

       

        false
   

    上面的部分已经足够将spring和jbpm结合起来了,appfuse中的集合也就做到上面的步骤
    该集成使用了spring-modules-jbpm31.jar
    具体使用的演示
    JbpmConfiguration config = (JbpmConfiguration) applicationContext.getBean("jbpmConfig");
    JbpmContext context = config.createJbpmContext();
    ProcessDefinition definition = context.getGraphSession().findLatestProcessDefinition("testProcess");
 
    //下面是mule中使用jbpm的配置,使用org.jbpm.msg.mule.Jbpm对其进行了封装,以便在jBpmConnector中使用
   
   
   
   
       
           
       

   

   
       
mule.xml

   
                   
                       
           
       
   
   
   
mule in spring-context

muleContext.xml


                   
     
     
   
 
   
   

or 一种简单一些的配置

muleContext.xml





web.xml


  contextConfigLocation  /WEB-INF/mule-spring-config.xml

org.springframework.web.context.ContextLoaderListener   

这样spring启动的时候,mule server也就启动了

========
使用spring和mule混合标签的config.xml

SpringConfigurationBuilder builder = new SpringConfigurationBuilder();
UMOManager manager = builder.configure("mule-spring-config.xml,mule-spring-components.xml");

接下来不需要做任何处理,因为之后都会通过
MuleManager.getInstance() 来获得该manager

br />  "http://www.symphonysoft.com/dtds/mule/mule-spring-configuration.dtd">
 
//create a client
MuleClient client = new MuleClient();
//send a jms message asynchronously
client.dispatch("jms://my.queue", "some data", null);
//or to receive a pop3 message via a configured mailbox
UMOMessage message = client.receive("pop3://myInboxProvider", 3000);
//or synchonous send a inter-vm message
UMOMessage message2 = client.send("vm://my.object", "Some more data", null); 

抱歉!评论已关闭.