jbpm与OSGi、Maven等的集成



我正在开发一个基于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();

我的问题是:

  1. 如何集成jbpm和Osgi java来调用和执行bpmn或决策表
  2. 为什么这些依赖关系未解决?我试了最新的7.46.0。流口水的最终版本也是吗

对于问题1,您需要来自org.kie.server.组的kie服务器客户端

您可能使用的其他依赖项是api中的定义(问题2(:来自group org.bpm的jbpm-kie服务和来自group org.kie.的kie-api、kie-internal

相关内容

  • 没有找到相关文章

最新更新