JBoss Community

How to deploy a BPMN process file by using the JBPM API ?

created by pichunhan pi in jBPM - View the full discussion

there's some questions for me .

 

In my project , i use the spring to manage the KnowledgeBase and the StatefulKnowledgeSession , and the config XML is follow .

 

<drools:kbase id="kbase">

              <drools:resources>

                <drools:resource type="BPMN2" source="classpath:Evaluation.bpmn" />

                <drools:resource type="BPMN2" source="classpath:WorkTrip.bpmn" />

                <drools:resource type="BPMN2" source="classpath:HR_WorkTrip.bpmn" />

                <drools:resource type="BPMN2" source="classpath:Common_WorkTrip.bpmn" />

                <drools:resource type="BPMN2" source="classpath:Performance.bpmn" />

              </drools:resources>

          </drools:kbase>

 

          <drools:ksession id="sSession" type="stateful" kbase="kbase">

    <drools:configuration>

      <drools:jpa-persistence>

        <drools:transaction-manager ref="txManager" />

        <drools:entity-manager-factory

          ref="entityManagerFactory" />

      </drools:jpa-persistence>

    </drools:configuration>

            </drools:ksession>

 


but when i need to add a new BPMN process resource , i need to add a drools:resource config and restart the web server to deploy it into the  KnowledgeBase which is used in my project .

is there a JBPM API for me to deploy it into the KnowledgeBase without using the guvnor ? Like the way in JBPM4.x .

 

in the JBPM demo , i know that the BPMN resource can be deployed by using this code :

 

private static KnowledgeBase readKnowledgeBase() throws Exception {

                    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory

                                        .newKnowledgeBuilder();

                    kbuilder.add(ResourceFactory.newClassPathResource("Evaluation.bpmn"),

                                        ResourceType.BPMN2);

                    return kbuilder.newKnowledgeBase();

          }

 

but when i used the spring , i can't do this to deploy now . because if i use this way , the KnowledgeBase and the StatefulKnowledgeSession are the new instance different with the one in spring IOC .

 

how can i do ? is there any way to do without using the guvnor web ? just using the JBPM API .

Reply to this message by going to Community

Start a new discussion in jBPM at Community