我正在开发一个基于osgi(apachefelix)和maven的微服务。我正在学习jbpm。我已经创建了一个决策表,我需要从我的osgijava项目中调用它。下面是我从bpmn的javadoc中使用的代码,但似乎它不起作用,因为虽然我从maven导入了一堆依赖项,但仍然有很多其他依赖项,比如
KnowledgeBaseConfiguration
ResourceFactoryService
ResourceFactoryService
KnowledgeBase
仍未解决。
<drools.version>7.0.0.Final</drools.version>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-bpmn2</artifactId>
<version>${drools.version}</version>
</dependency><!-- https://mvnrepository.com/artifact/org.drools/drools-core -->
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>${drools.version}</version>
</dependency><!-- https://mvnrepository.com/artifact/org.drools/drools-osgi-integration --><!-- https://mvnrepository.com/artifact/org.drools/drools-decisiontables -->
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-decisiontables</artifactId>
<version>${drools.version}</version>
</dependency><!-- https://mvnrepository.com/artifact/org.drools/drools-api -->
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>${drools.version}</version>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
<version>${drools.version}</version>
</dependency>
这就是我在jbpm文档中与osgi集成一节中找到的逻辑
ServiceReference serviceRef = bundleContext.getServiceReference( ServiceRegistry.class.getName() );
ServiceRegistry registry = (ServiceRegistry) bundleContext.getService( serviceRef );
KnowledgeBuilderFactoryService knowledgeBuilderFactoryService = registry.get( KnowledgeBuilderFactoryService.class );
KnowledgeBaseFactoryService knowledgeBaseFactoryService = registry.get( KnowledgeBaseFactoryService.class );
ResourceFactoryService resourceFactoryService = registry.get( ResourceFactoryService.class );
KnowledgeBaseConfiguration kbaseConf = knowledgeBaseFactoryService.newKnowledgeBaseConfiguration( null, getClass().getClassLoader() );
KnowledgeBuilderConfiguration kbConf = knowledgeBuilderFactoryService.newKnowledgeBuilderConfiguration( null, getClass().getClassLoader() );
KnowledgeBuilder kbuilder = knowledgeBuilderFactoryService.newKnowledgeBuilder( kbConf );
kbuilder.add( resourceFactoryService.newClassPathResource( "MyProcess.bpmn", Dummy.class ), ResourceType.BPMN2 );
kbaseConf = knowledgeBaseFactoryService.newKnowledgeBaseConfiguration( null, getClass().getClassLoader() );
KnowledgeBase kbase = knowledgeBaseFactoryService.newKnowledgeBase( kbaseConf );
kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
return Optional.empty();
我的问题是:
如何集成jbpm和osgijava来调用和执行bpmn或决策表?
为什么这些依赖关系没有解决?我也试过最新的7.46.0最终版本的drools?
1条答案
按热度按时间zengzsys1#
对于问题1,您需要来自group org.kie.server的kie服务器客户端。
您可能使用的其他依赖项是api中的定义(问题2):来自group org.jbpm的jbpm kie服务和来自group org.kie的kie api、kie internal。