首页 > 其他分享 >JBPM5 配置得到两个Session和一些配置参考信息

JBPM5 配置得到两个Session和一些配置参考信息

时间:2023-03-20 20:08:16浏览次数:41  
标签:www http Session spring 配置 springframework JBPM5 org schema


[color=red][b]配置得到StatefulKnowledgeSession[/b][/color]

package com.v0610.basic.jbpm.example;

import org.drools.runtime.StatefulKnowledgeSession;

public class MyObject {
private StatefulKnowledgeSession ksession;

public void setSession(StatefulKnowledgeSession ksession) {
this.ksession = ksession;
}

public void doSomething() {
System.out.println("YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY");
ksession.startProcess("com.v0610.basic.temp.helloworld");
}
}


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:jbpm="http://drools.org/schema/drools-spring"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
http://drools.org/schema/drools-spring http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-container/drools-spring/src/main/resources/org/drools/container/spring/drools-spring.xsd
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

<jbpm:kbase id="kbase">
<jbpm:resources>
<jbpm:resource type="BPMN2" source="classpath:helloworld.bpmn"/>
</jbpm:resources>
</jbpm:kbase>
<jbpm:ksession id="ksession" type="stateful" kbase="kbase" />

<bean id="myObject" class="com.v0610.basic.jbpm.example.MyObject">
<property name="session" ref="ksession" />
</bean>
</beans>



[color=red][b]配置得到TaskServiceSession[/b][/color]


@PostConstruct
public void init() {
System.out.println("初始化Service类[JbpmSupport]------------------------------------------------------------------------.");
// 为 ksession 设置log
new JPAWorkingMemoryDbLogger(ksession);
new JPAProcessInstanceDbLog(ksession.getEnvironment());

// 创建 local human service 及其 handler
org.jbpm.task.service.TaskService tService = new org.jbpm.task.service.TaskService(entityManagerFactory,
SystemEventListenerFactory.getSystemEventListener());
taskServiceSession = tService.createSession();
// TODO 事务该如何设置?
// taskServiceSession.setTransactionType("RESOURCE_LOCAL");
SyncWSHumanTaskHandler humanTaskHandler = new SyncWSHumanTaskHandler(new LocalTaskService(taskServiceSession),
ksession);
humanTaskHandler.setLocal(true);
humanTaskHandler.connect();
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", humanTaskHandler);

// set user group callback
System.setProperty("jbpm.usergroup.callback", "org.jbpm.task.service.DefaultUserGroupCallbackImpl");
}
public TaskService getTaskService() {
return new LocalTaskService(taskServiceSession);
}



[color=red][b]一些配置参考信息[/b][/color]


jbpm5-spring-jta-beans.xml


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:jbpm="http://drools.org/schema/drools-spring"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
http://drools.org/schema/drools-spring http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-container/drools-spring/src/main/resources/org/drools/container/spring/drools-spring.xsd
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

<bean id="jbpmEMF"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="org.jbpm.persistence.jta" />
</bean>

<bean id="btmConfig" factory-method="getConfiguration" class="bitronix.tm.TransactionManagerServices"></bean>

<bean id="BitronixTransactionManager" factory-method="getTransactionManager"
class="bitronix.tm.TransactionManagerServices" depends-on="btmConfig" destroy-method="shutdown" />

<bean id="jbpmTxManager" class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager" ref="BitronixTransactionManager" />
<property name="userTransaction" ref="BitronixTransactionManager" />
</bean>

<jbpm:kbase id="kbase2">
<jbpm:resources>
<jbpm:resource type="BPMN2" source="classpath:helloworld.bpmn" />
</jbpm:resources>
</jbpm:kbase>

<jbpm:ksession id="ksession2" type="stateful" kbase="kbase2">
<jbpm:configuration>
<jbpm:jpa-persistence>
<jbpm:transaction-manager ref="jbpmTxManager" />
<jbpm:entity-manager-factory ref="jbpmEMF" />
</jbpm:jpa-persistence>
</jbpm:configuration>
</jbpm:ksession>

</beans>



jbpm5-beans.xml


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:kb="http://drools.org/schema/drools-spring"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
http://drools.org/schema/drools-spring http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-container/drools-spring/src/main/resources/org/drools/container/spring/drools-spring.xsd
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

<!-- jBPM Knowledge Related Config -->
<kb:grid-node id="node1"/>
<kb:kbase id="kbase1" node="node1">
<kb:resources>
<kb:resource type="BPMN2" source="classpath:helloworld.bpmn"/>
</kb:resources>
</kb:kbase>
<kb:ksession id="ksession1" type="stateless" kbase="kbase1" node="node1"/>

<!-- Camel Config -->
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

<cxf:rsServer id="rsServer" address="/rest" serviceClass="org.drools.jax.rs.CommandExecutorImpl">
<cxf:providers>
<bean class="org.drools.jax.rs.CommandMessageBodyReader"/>
</cxf:providers>
</cxf:rsServer>
<cxf:cxfEndpoint id="soapServer"
address="/soap"
serviceName="ns:AttachmentWsService"
endpointName="ns:AttachmentWsServicePort"
wsdlURL="wsdl/attachment.wsdl"
xmlns:ns="http://ws.basic.v0610.com" >
<cxf:properties>
<entry key="dataFormat" value="MESSAGE"/>
<entry key="defaultOperationName" value="execute"/>
</cxf:properties>
</cxf:cxfEndpoint>

<bean id="kbPolicy" class="org.drools.camel.component.DroolsPolicy" />
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="cxfrs://bean://rsServer"/>
<policy ref="kbPolicy">
<unmarshal ref="xstream" />
<to uri="drools:node1/ksession1" />
<marshal ref="xstream" />
</policy>
</route>
<route>
<from uri="cxf://bean://soapServer"/>
<policy ref="kbPolicy">
<unmarshal ref="xstream" />
<to uri="drools:node1/ksession1" />
<marshal ref="xstream" />
</policy>
</route>
</camelContext>
</beans>

标签:www,http,Session,spring,配置,springframework,JBPM5,org,schema
From: https://blog.51cto.com/u_3871599/6138524

相关文章

  • tomcat配置虚拟路径,供用户访问静态资源
    tomcat配置虚拟路径,供用户访问静态资源在实际开发中,后台需要提供给用户访问静态资源,而且该静态资源不是在tomcat中,即不是在web目录下,那么用户是不能访问的,这时,需要配置tomc......
  • spring context.xmL配置数据库事务以及aop
    [color=red][b]xml配置方式[/b][/color]!--fromthefilecontext.xml--><?xmlversion="1.0"encoding="UTF-8"?><beansxmlns="http://www.spri......
  • Nginx服务配置及相关模块
    一、Nginx配置文件1.主配置文件解析①yum安装主配置文件位置:/etc/nginx/nginx.conf②编译安装主配置文件位置:/编译安装路径/conf/nginx.conf1nginx主配置文件:nginx......
  • redis存储session如何查询当前请求的sessionID
    redis存储session如何查询当前请求的sessionID问题项目登录信息session使用的redis存储,在排查bug过程中需要查询缓存;发现无法知道,当前的浏览器请求获取到的缓存信息;解......
  • Spring容器管理的配置Bean转换对象为json字符串时StackOverflowError问题
    背景项目中某配置类XxxConfig定义了很多配置参数,通过Spring的@Value注解与配置中心的项目yml里的配置项关联。@Slf4j@Getter@Setter@RefreshScope@Configurationpub......
  • Mybatis 源码(五):SqlSession对象构建
    SqlSession对象创建核心在SQL执行器Executor对象的创建,sqlSession持有Executor对象。1、SqlSession对象的创建应用程序每次操作数据库,都需要创建一个sqlSession对象,......
  • Windows Server 2016配置NTP客户端
    前提:开通WindowsTime 服务输入services.msc进入服务管理界面,找到WindowsTime 开启服务。情况1:可以直接设置NTP时钟控制面板——时钟和区域——设置时间和日期——I......
  • Jenkins安装及常用配置
    1)JDK安装及环境变量配置jdk一般选择1.8及以上版本,jdk环境具体安装步骤请擢:   这里这里 2)Jenkins安装    3)Jenkins配置  ......
  • Nginx代理testlink配置说明
    upstreamtestlink{server192.168.8.253:80weight=1max_fails=3fail_timeout=3s;}server{listen80;listen443ssl;server_nametestlink.test.com;ssl_certificate......
  • 配置LNMP发布论坛网站(二)​
    拓扑图:​推荐步骤:​安装依赖程序和安装mysql数据库​安装Nginx和php​配置Nginx连接php协同工作,配置DNS服务器使用域名www.bbs.com访问静态和动态网站​在Nginx服务器配置发......